Skip to content

feat(kernel): add owned fresh task queue - #915

Draft
Haoming9527 wants to merge 2 commits into
work/872-native-task-substratefrom
work/872-native-task-kernel
Draft

Haoming9527 wants to merge 2 commits into
work/872-native-task-substratefrom
work/872-native-task-kernel

Conversation

@Haoming9527

@Haoming9527 Haoming9527 commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Refs #872. Stacked on #914; this internal protocol slice does not close the full feature.

What was wrong

The resident kernel could queue persistent shell requests but had no bounded executor for independently owned fresh tasks or explicit background lifetime. Reusing shell completion rules would either terminate registered job descendants too early or retain ordinary command descendants unintentionally. Pending approval also must not prevent cancellation, queue deadlines or owner teardown.

The change

Add the internal Windows task-v1 protocol with eight fixed workers, 32 retained task records, 32 exact private owners and 64 owner controls. Every head requests current host admission and launches only the exact confined argv/cwd/environment supplied for that request. Independent nested Jobs retain atomic public-host ownership. Queue-inclusive hard deadlines, cancellation and owner close join the range and readers before terminal publication; unconfirmed cleanup reports a structured error, poisons the owner and withdraws the transport.

Ordinary root exit retires remaining descendants after its bounded grace. Explicit job lifetime and accepted promotion retain the same physical range; promotion and cleanup use one arbitration lock. Promotion does not remove a separately requested hard execution cap. Raw output reads retain a 64,000-byte tail per stream with independent byte cursors, loss, EOF and errors. Shell/task replies share one bounded 512-frame writer; asynchronous output saturation or write failure closes the independently held control endpoint.

The implementation is approximately 950 added source lines excluding tests and documentation. Bilingual docs and changelog specify the wire and its limits. Production fresh/Jobs routing, recoverable spill, persistent-runtime eligibility and full performance acceptance remain pending. POSIX explicitly advertises no task capability. No dependency, runtime pin, public schema or release change.

Validation

The native workspace run before the final additional regressions passes 711 tests, zero failures, three ignored fixtures/platform cases. The final task suite passes nine tests, zero failures, one ignored child fixture explicitly launched by the real lifecycle tests: saturated approval queue and independent deadline/cancellation, owner-close ordering and stale admission, a deterministically sealed queued owner, fractional timers, structured cleanup failure, real closed stdin and exit 259, two-stream bounded tails, fresh descendant retirement, explicit/promoted job lifetime and hard deadline preservation. Final workspace/all-target Clippy with -D warnings, formatting and diff checks pass. TypeScript build, all 117 workflow checks and all 893 tracked code files pass.

Final worker SHA-256: 2fcf7f1d608b71fe53d121c892465bd58bf0bb04765d7ee260c441c1c58c3b2e. Shared-writer regressions against the preceding worker 5a2e34d8174244271abf14fcd653a9c2c49463fd81f103afe14725607cbdfcbc pass 3/3 blocked-start checks (cancel, close and deadline) and 2/2 paused-reader shutdown checks. Shutdown joined the actual kernel and quiet child in 597 ms while 4,063,232 submitted output bytes remained unread; the sibling kernel stayed usable, with no observed survivors or cleanup failures. The follow-up changes only task owner/admission ordering and its regression, not the shared writer.

The companion internal task-host prototype passed 7/7 real public-host checks against this exact final worker: actual public Jobs ownership/handoff/promotion, targeted cleanup, closed stdin, bounded tails and explicit stock fresh Bash command/script argv. Nine tasks completed their observed lifecycle, kernel PID 15456 was gone and cleanup was confirmed. The report SHA-256 is 3d0c4e3831abf1e462a5838d5e1959281593a8a090a829943fb4005cc1eef1e8. Its final host suites pass 44/44 checks, zero skips. These are supporting integration evidence, not this slice's production activation claim: workspace-write reports partial confinement, and the production policy bridge/spill remain pending.

The first paired owner-close negative control passed with and without its guard, so it was retained as inconclusive. A deterministic fixture now queues an uncancelled request behind an already sealed owner. The actual owner guards pass 1/1; removing only the two owner-closed defenses fails 0/1, exit 101, because the first frame incorrectly requests admission. Both runs join shutdown before asserting and neither is retried. Sealing and bounded admission publication additionally share the owner lock, closing the check-to-enqueue ordering gap without changing the existing pre-launch effect fence. Required pull-request CI is green for 672cb9f7ad4e0a4e339d407d33171097f5e15d50: https://github.com/T-Auto/dsh-ops/actions/runs/43485221428 . All required jobs passed. The ordinary CI native workspace gate includes the new real task lifecycle assertions on Windows.

Environment

Windows x64, Node 26.12.1, Rust 1.99.0 locally; CI uses the repository-pinned toolchain. Base: 9c1cd468411da812c46a2cd092d91bdf6264bd58. Public DSH packages from the unchanged lockfile. No merge, release or deployment.

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