Repository navigation
feat(process): own Windows shell ranges and private channels - #908
Draft
Haoming9527 wants to merge 2 commits into
Draft
Haoming9527 wants to merge 2 commits into
Haoming9527 wants to merge 2 commits into
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.
Refs #872. Stacked on #906 (
work/872-resident-isolation). This is the Windows process and channel slice; #872 remains open.What was wrong
The resident kernel could own independently cancellable file leaves, but had no process range suitable for long-lived shells launched with the host's exact confinement argv. A shell needs atomic ownership before any child can run, isolated cancellation, bounded private channels and cleanup that waits for every reader.
The change
Add
ops-process::shellwith an atomic nested Windows Job and explicit inherited-handle list. Each shell gets a hidden private console, an explicit environment and EOF stdin. Private named pipes have bounded retention and connection counts, owner/logon ACLs, and peer membership checks against the shell's Job. Cleanup drains admitted peers to EOF and joins all readers even after an earlier reader error.Ctrl+C is attempted by a short-lived controller in its own owned range. This avoids a reproduced Windows race where resetting the resident process's console handlers terminated the kernel with
STATUS_CONTROL_C_EXIT. The controller has fixed internal argv, an empty environment, bounded diagnostics and a deadline; it is joined on success, timeout and crash. A successful receipt means an interrupt attempt, not target cooperation. Restricted wrappers may require hard termination of the affected range.Add a real public-host Windows probe to CI and bilingual documentation. No new dependency versions; only features of the existing
windows-syspin are enabled. The slice has approximately 1,090 production Rust lines, excluding tests; the largest added code file is 434 lines. Atomic creation and drain/cancellation handling stay together in the platform module.Published tools and the pinned Niubash distribution retain their current behavior. Persistent command receipts, session queues, permission readmission, explicit DSH jobs and full performance acceptance follow in connected slices. POSIX support for this new range returns an explicit unsupported error: independent process groups have not established the required host-fallback ownership.
Validation
Local Windows x64 results:
The public-host probe covers all three permission modes (the two restricted modes report their actual
partialenforcement), exact confined argv, argument quoting, private descriptor channels, rejected foreign peers, four independent 1 MiB streams retaining 1,024 bytes each, early detached children remaining owned, helper timeout/crash, subsequent kernel requests, sibling survival, two cooperative fixture shells trapping INT and exiting 42, hard kernel death and control EOF. Regressions caught and corrected during development include lost final output, short-circuited reader joins and the console-handler race. These are process-layer results, not a completed persistent-shell acceptance report.The first run (https://github.com/T-Auto/dsh-ops/actions/runs/43455915383) passed all functional gates but failed the Windows probe's cooperative INT assumption. This reproduced locally under Git Bash: its inherited ignore-Ctrl+C state differed from PowerShell. A test-only wrapper now explicitly enables Ctrl+C for the positive target and protects its waiter with a non-inherited handler. Production behavior is unchanged. The corrected probe passes 13/13 under both Git Bash and PowerShell, with no survivors, retries or skipped assertions; focused Clippy, formatting, workflow checks and size checks pass.
pull_requestCI passed for corrected commit02b9368b116b317b2734a89d2151fa267189f795: https://github.com/T-Auto/dsh-ops/actions/runs/43458944117 . Every required job passed, including all four platform functional gates, Linux/Windows/macOS Clippy, Node-floor compatibility, and the real-host Windows shell probe.Environment
Windows x64, Node 26.12.1, Rust 1.99.0 locally; CI uses the repository-pinned Rust toolchain. Base:
e9068c78cac751d96ae1ebff3db65b9ae581c2f0. Public DSH packages and the frozen official Niubash 1.5.0 payload from the existing locked checkout. No published dependency or package version changes.