Repository navigation
Conversation
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.
Summary
Fix Windows daemon startup failures caused by residual Job Object membership.
Related: openai#44503
Investigation
A native probe remained in a Job Object but survived launcher exit and terminal closure. A separate
KILL_ON_JOB_CLOSEcontrol confirmed that closing the Job terminated its child.To test whether checking only the immediate Job is sufficient, the next experiment used this hierarchy:
A child launched with
CREATE_BREAKAWAY_FROM_JOBescaped the inner Job but remained in the middle and outer Jobs. Closing the outer Job terminated it, even though its immediate Job had noKILL_ON_JOB_CLOSE.The alternative was tested without administrator privileges: WMI created a temporary parent, and the launcher created the child using its own token and that parent. The child:
A normally launched child in the same experiment terminated when the outer Job closed.
Fix
Keep the direct launch when the child has no remaining Job membership. Otherwise, terminate the child and retry using a temporary WMI-created parent and the original caller's token.
Preserve arguments, environment, working directory, and stdio. Verify the temporary parent's identity through a private named pipe and release it after launch. Apply the fallback to both preflight and daemon startup while retaining elevated-launch rejection.
Validation
codex-app-server-daemonandcodex-arg0.CODEX_HOMEconfirmed startup, survival after terminal closure, restart, a working CLI conversation, and shutdown.