Skip to content

Start path: fall back on a setup failure, guard the output readers, warn once, report Version and StartMode - #65

Merged
HalRiveria-Bot merged 2 commits into
mainfrom
fix/start-path-fallback
Nov 17, 2026
Merged

HalRiveria-Bot merged 2 commits into
mainfrom
fix/start-path-fallback

Conversation

@HalRiveria-Bot

Copy link
Copy Markdown
Collaborator

3.2 starts each program inside the Job Object (TryStart). Three weak spots around that, none with a known trigger on a supported Windows, plus a way to see which path is in use:

  • A setup error failed the start. In 3.1 a failed Assign only cost that program its force-kill cleanup. In 3.2 a Win32 error while setting up the start (the pipes, the attribute list, the job attribute) became "could not start".
  • The output readers were built after the program was resumed, outside the guard. If building one failed, the program ran on with nothing tracking it, and the start was reported as failed.
  • Falling back to Process.Start was silent. If a future .NET moves the private start-lock field, or setup fails, the kit quietly goes back to 3.1's way, where a child a program starts straight away can escape the cleanup, while the README states the guarantee without qualification.

What changed

  • A setup failure now falls back to Process.Start plus the Job Object, as 3.1 did. A failure of CreateProcess itself (file not found and so on) still reports that the program couldn't start.
  • The readers are built inside the guard, before the program is resumed; if anything there fails, the still-suspended program is ended and every handle released.
  • The first fallback in a PowerShell process (no usable start lock, or a setup failure) prints a warning saying what it costs. The harness's own switch to that path stays quiet.
  • Initialize-ParallelKit also returns Version and StartMode (CreatedInJob, AddedToJob or NoJob). The README says what each means, that it's the session's default rather than a promise for every program, and asks for this output in bug reports. The header's Version line and the new constant name each other, and the harness checks they match.

Before this, I checked whether creating a program with a job list can fail where 3.1's Assign worked, with PowerShell already inside a restrictive Job Object (no limits, kill-on-close, breakaway allowed, silent breakaway, all UI restrictions, active-process limits including one reached exactly at the start). Both paths behaved the same on 5.1 and 7 every time, so only setup failures fall back.

The compiled types changed (types version 6): after updating, start a new PowerShell window.

Testing

  • New harness section AW, using two new test-only switches that force a setup failure or a reader failure:
    • With setup forced to fail, two starts both succeed in the Job Object, with exactly one warning.
    • The harness's own switch doesn't warn.
    • With the readers forced to fail, the start throws and the program isn't left running.
    • Version matches the header; StartMode is CreatedInJob, or AddedToJob without the start lock.
  • All five behavior checks failed with the switches added at the old failure points (the start failed with "Access is denied", the program was left running, the fields were missing) and pass with the fix.
  • Full harness passes in fresh processes on Windows PowerShell 5.1 and PowerShell 7 (532 assertions each).

🤖 Generated with Claude Code

HalRiveria and others added 2 commits November 17, 2026 18:03
…e, report Version and StartMode

- A Win32 error while setting up a start inside the Job Object (pipes,
  the attribute list, the job attribute) failed the start, where 3.1 only
  lost that program's force-kill cleanup. It now falls back to
  Process.Start plus Assign; a failure of CreateProcess itself still
  reports that the program couldn't start.
- The output readers were built after the program was resumed, outside
  the guard: if one failed, the program ran on untracked. They're built
  inside the guard now, and a failure ends the still-suspended program.
- Falling back (no usable start lock, or a setup failure) was silent. It
  now warns once per process, saying a child started straight away can
  escape the cleanup.
- Initialize-ParallelKit also returns Version and StartMode
  (CreatedInJob, AddedToJob or NoJob).

The compiled types changed (TypesVersion 6): start a new PowerShell
window after updating.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@HalRiveria-Bot
HalRiveria-Bot merged commit eceabaf into main Nov 17, 2026
2 checks passed
@HalRiveria-Bot
HalRiveria-Bot deleted the fix/start-path-fallback branch November 17, 2026 23:14
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.

2 participants