Skip to content

fix(artifacts): cancel idle .NET bundle member streams - #10302

Closed
ShuaixinHuang wants to merge 2 commits into
morluto:mainfrom
ShuaixinHuang:fix/dotnet-idle-member-cancellation
Closed

ShuaixinHuang wants to merge 2 commits into
morluto:mainfrom
ShuaixinHuang:fix/dotnet-idle-member-cancellation

Conversation

@ShuaixinHuang

@ShuaixinHuang ShuaixinHuang commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Cancel .NET bundle member streams while consumers are idle or backpressured, preserving exact cancellation reasons and the established precedence of I/O, validation and cleanup failures.

Trigger and ownership fix

DotnetBundleArtifactReader.open(entry, signal) returns Readable.from() over an async generator. Cancellation was checked only when that generator advanced. Aborting after open() or after buffering a chunk left the outer readable alive until its consumer resumed, for both stored and raw-DEFLATE members.

The outer readable now observes cancellation and input/decoder failures independently of consumer demand. The existing descriptor reader retains ownership of pending native reads. Failures from the generator body are recorded before for-await closes the decoder, so cleanup AbortError cannot replace an already observed cancellation or size refusal. Final source validation similarly settles its I/O outcome before late cancellation; stream, signal and decoder listeners remain owned through readable closure.

Iterator and event failures share one projection. Parsed manifests, resource limits, paths, artifact identity, CLI/MCP schemas, package metadata and authority remain unchanged. This is an existing static-reader correction; no maintainer scope decision or new provider, target execution, injection or network capability is involved. Related #10111 covers separate Bun/PyInstaller pump finalization. No duplicate .NET fix was found; the reproduction is contained in this PR rather than a separate issue.

Regression evidence

  • Twelve production-boundary cases: stored/compressed × unstarted/backpressured × null/object abort reasons; a prefetched descriptor EIO; cancellation while multi-read compressed input is pending and genuine decoder bytes remain buffered; final descriptor-validation success and failure during cancellation. Actual readable/decoder-close events and deferred FileHandle calls establish these stages, with no sleeps or timeout changes. The native inflater spy is pass-through; its output is not faked.
  • Strengthen the existing extraction over-expansion fixture to span multiple decoder chunks, retaining its limit and no-published-output assertions. No duplicate module/CLI golden.
  • Final two test files on otherwise unchanged main 9c86465d47e98306e1ee1f77e7fb25d1d737b1db: 8 failed / 47 passed, 55 tests. All eight idle-cancellation cases failed; the failure-precedence controls passed.
  • Review P1 4559722577 was verified on f5d1324b4: the updated boundary file produced 2 failed / 10 passed, reproducing cleanup-error replacement and final-stat EIO replacement. Both were corrected in 5e028f8bb208ecec3232392bc329365cd969abbb, explained with evidence in the thread, then resolved.
  • Repaired selection: 5 files / 66 passed, including existing active-read cancellation, physical-read errors, .NET manifest/integrity/extraction boundaries, descriptor-stream tests, and compiled CLI/SDK stdio MCP inventory/extraction journeys.
  • Compiled-reader checks: 6 real-file/native-zlib over-expansion probes retained limit for 65,536 / 300,000 / 2,000,000 expanded bytes, repeated and random data. A controlled final-stat probe retained io, the EIO code and the identical failure object.
npm run test:focused -- tests/boundary/filesystem/dotnetBundleCancellation.test.ts tests/boundary/filesystem/dotnetBundleArtifacts.test.ts tests/boundary/filesystem/dotnetBundleIntegration.test.ts tests/acceptance/dotnetBundleJourney.test.ts tests/boundary/filesystem/fileHandleChunks.test.ts

Current-head validation and limits

Pinned Node24.22.1/npm11.16.0.

  • npm run check:fast and the six static components (typecheck, lint, format:check, knip, metadata:check with their dependencies) — passed.
  • npm run verify:architecture-guards — passed across 2,761 source files; npm run knip:production — passed, with its advisory candidates retained.
  • Type-aware lint of all 3 changed files — 0 errors / 0 warnings.
  • npm run verify:test-discovery — all 3,495 test files discovered exactly once.
  • Normal commit/pre-push hooks and git diff --check passed. All three public 5e028f8bb blobs match the checked local inputs.
  • Complete current-head default typed inventory — 7,228 files / 0 errors / 4,985 warnings in nine serial node scripts/ci/static-check-report.mjs typed-lint <batch files> runs. Exact per-batch discovery, total file coverage and final input/config hashes were verified, with no duplicates, omissions or changed inputs. Resource settings: GOMAXPROCS=1 GOGC=25 GOMEMLIMIT=1536MiB NODE_OPTIONS=--max-old-space-size=1536.

An initial-head monolithic npm run check reached its final typed-lint stage and received SIGKILL in this 8 GiB environment. A complete single invocation is not claimed to pass; current-head components and the separately partitioned full typed inventory are reported individually. Earlier superseded qualifications are kept separate, including one stopped after self-review reproduced the expansion-error regression. No GitHub CI was cancelled or retried.

These are self-owned format fixtures, real descriptor/stream/zlib operations, and compiled CLI/stdio MCP workflows, with controlled descriptor failures for competing outcomes. No real dotnet publish apphost corpus, .NET runtime, Windows runtime or target assembly execution was qualified. Native reads retain their existing non-interruptible settlement semantics.

Current-head CI 43369746017, attempt 1, completed successfully on 5e028f8bb208ecec3232392bc329365cd969abbb: 17 successful jobs and 23 configured skips (40 jobs total). Configured skips are not counted as passes. Automatic code review completed on 5e028f8bb208ecec3232392bc329365cd969abbb with no findings and no unresolved threads. The original verified P1 was explained and resolved after the fix; human Author readiness remains separate.

Author readiness

Human owner: @ShuaixinHuang

The owner explicitly declared this PR reviewed and ready for initial review on 2026-11-13 (Asia/Shanghai), for head 5e028f8bb208ecec3232392bc329365cd969abbb. This records initial readiness under CONTRIBUTING and does not claim review of future commits.

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T05:13:42.294176Z 5e028f8 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f5d1324b49

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: evidence Evidence, artifacts, and reconstruction bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants