Skip to content

fix(artifacts): preserve member stream failures through reader close - #12489

Merged
morluto merged 3 commits into
mainfrom
fix/artifact-member-stream-lifecycle
Nov 19, 2026
Merged

morluto merged 3 commits into
mainfrom
fix/artifact-member-stream-lifecycle

Conversation

@morluto

@morluto morluto commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Summary

Preserve the result of admitted member reads and final verification when an artifact reader closes. Fixes #12487. Builds on the descriptor-read ownership landed in #11748.

Problem and change

Several artifact readers destroyed member output as soon as close was requested. A pending file read or final descriptor check could later fail physically, after the consumer had already received unavailable.

Positional readers, uImage, Bun, and Deno now share member-stream shutdown handling. Close joins admitted producer and verification work. A physical failure reaches the consumer. When I/O succeeds, the first caller abort or reader close determines the result. Owned descriptors retire after joined cleanup and borrowed descriptors remain usable. Bun also checks selected-path identity at member completion, after a verified case in which same-byte replacement passed undetected.

Evidence and validation

  • Authored boundary regressions reproduced lost EIO on held reads and final descriptor verification. The corrected cases preserve the exact cause, distinguish caller-first and close-first interruption, and check descriptor ownership. A paired same-byte replacement verifies Bun and Deno path identity.
  • All 63 focused tests passed on the current main-based revision, including the 27 shared lifecycle cases and compiled CLI/MCP tests for Godot PCK, Node SEA, uImage, Bun, and Deno. check:fast, formatting, and diff checks passed.
  • The scope is passive member reads. Readers with separate producer or reconstruction paths need their own ownership proof. No public schema change.

Author readiness

Human owner: @morluto

  • 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 19, 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-19T19:23:30.023808Z 7639634 PR opened
ℹ️ 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.

@greptile-apps

greptile-apps Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The reviewed changes appear safe to merge; no blocking code issue was found.

Summary

This PR shares member-stream shutdown handling across positional, uImage, Bun, and Deno readers.

  • Artifact readers keep admitted member failures through close.
  • Bun checks that the selected file stays the same through member reads.

No actionable new issues were found. Review conclusions are source-based; tests were not run. Supersession could not be checked because GitHub access required authentication.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Open member] --> B[Combine caller and reader-close signals]
  B --> C[Read member bytes]
  C --> D[Check byte count and source identity]
  C -->|Physical failure| E[Return original failure]
  D -->|Physical failure| E
  D -->|Checks succeed| F{Interrupted?}
  F -->|Caller first| G[Return cancelled]
  F -->|Close first| H[Return unavailable]
  F -->|No| I[Complete stream]
  E --> J[Retire stream]
  G --> J
  H --> J
  I --> J
  J --> K[Close owned descriptor after joined work]
Loading

Reviews (2) · Last reviewed commit: "fix(artifacts): retain standalone read f..." · Reviewed by Greptile

@morluto
morluto enabled auto-merge (squash) November 19, 2026 19:25
@morluto
morluto merged commit b5a9d48 into main Nov 19, 2026
40 checks passed
@morluto
morluto deleted the fix/artifact-member-stream-lifecycle branch November 19, 2026 19:28
@morluto morluto added area: evidence Evidence, artifacts, and reconstruction bug Something isn't working labels Nov 22, 2026
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.

[Bug] Artifact reader close masks admitted member read failures

1 participant