Skip to content

perf(shell): wake sealed channel readers without polling - #944

Draft
Haoming9527 wants to merge 1 commit into
work/872-runtime-candidate-handofffrom
work/872-channel-wakeup
Draft

Haoming9527 wants to merge 1 commit into
work/872-runtime-candidate-handofffrom
work/872-channel-wakeup

Conversation

@Haoming9527

@Haoming9527 Haoming9527 commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Refs #872 and #932. Stacked on #933; this is a measured performance slice, not full acceptance.

What was wrong

Each Windows session command sealed three private channels, but pending connects woke on a timer and drain polled reader completion. On this host the unchanged driver measured 46.33 ms p50 / 51.10 ms p95 for 300 empty commands.

The change

Signal pending connect operations with a manual-reset event and wait for physical reader-thread termination using owned thread handles. Active reads still drain to authenticated EOF, spill settlement stays checked, and cancellation joins overlapped I/O before releasing buffers.

Add normal-gate real resident-worker assertions for current-generation forged stdout receipts, surviving background jobs (including disowned redirected jobs), sibling preservation, and explicit rejection of unregistered stock asynchronous output. The Windows-only suite is an explicit platform skip on POSIX; missing Windows runtime remains a failure.

Include bilingual performance notes, the supplied harness with executable-path parameters, and both paired raw reports. No dependencies, runtime pins, public contracts, output caps, or model schemas changed.

Validation

  • cargo test --locked --manifest-path native/Cargo.toml -p ops-process: 43 passed, 0 failed, 5 ignored child fixtures.
  • cargo clippy --locked --manifest-path native/Cargo.toml -p ops-process --all-targets -- -D warnings: passed.
  • npm run build: passed.
  • DSH_OPS_REQUIRE_RUNTIME=1 node test/run.mjs resident-shell-integrity: 3 checks passed, 1 suite, no skips.
  • Named acceptance regression filters (verify-gate, authority, persistent-admission, persistent-mode, resident-shell-channel, resident-shell-output, resident-shell-admission, session-reset-notice, native-ranges, shell-slot, shells-native-spill): 12 suites passed, 0 failed/skipped.
  • node scripts/check-file-size.mjs: 950 code files passed; longest 948 lines. git diff --check: passed.
  • Full local node scripts/verify-gate.mjs --skip-install: 741 Rust tests passed (8 ignored fixtures/platform cases), 264 JavaScript suites passed, 4 allowed skips, and 92 manifest checks passed. The command failed at package extraction because Windows bsdtar rejected non-ASCII filenames. Repeating that exact package extraction with installed GNU tar 1.35 succeeded; the subsequent packed-runtime closure check passed (1 runtime, SHA-256 1bb7a20ba597c45b6d761df8bc7dbc12fc255dc866ff2f84556d012a65f0d15c). The original gate exit remains reported as failed; PR CI is the cross-platform reference.
  • PR-triggered CI required: run 43608861159, exact head 24ac360551c1336453b78268090574f97a1de50a, passed. All 10 jobs succeeded, including Windows/Linux/macOS functional gates and the aggregate CI required check.

Paired empty-command results (p50 / p95): connect wake alone 46.48 / 48.77 → 16.05 / 17.22 ms; connect wake plus thread-handle wait 46.33 / 51.10 → 9.04 / 10.30 ms. Each run uses 300 samples, 30 warmups and the same stock executable. Full raw results include printf tails without filtering.

The ≤1 ms p50 / ≤3 ms p95 target is not met. The 106-operation scenario, cold startup, host orchestration, Linux comparison, channel pooling and redundant prompt/file work remain outstanding. The attached scenario summary disagrees with its raw report and needs reconciliation. These driver-only results do not establish full feature or end-to-end performance acceptance.

Environment

Windows x64, Ryzen 7 6800HS, Node 26.12.1, Rust 1.97.1 release binaries built in isolated target directories. Parent is #933 at 06c22a65, whose PR-triggered CI passed: https://github.com/T-Auto/dsh-ops/actions/runs/43554104077. This host differs from the maintainer's i9-13900H.

See performance evidence for exact hashes and measurement limits.

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