Skip to content

fix(artifacts): preserve iNES shutdown ownership and I/O failures - #10554

Closed
ShuaixinHuang wants to merge 5 commits into
morluto:mainfrom
ShuaixinHuang:fix/ines-retirement-replacement-main
Closed

ShuaixinHuang wants to merge 5 commits into
morluto:mainfrom
ShuaixinHuang:fix/ines-retirement-replacement-main

Conversation

@ShuaixinHuang

@ShuaixinHuang ShuaixinHuang commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Problem and fix

Closing an iNES reader during a region read or final identity check could release an extraction-owned descriptor before admitted work retired. Buffered streams and paused inventories could continue after closure. A shared descriptor-read race could also replace a physical I/O failure with cancellation while forwarding its rejected read.

Use the existing artifact resource scope to admit work, stop producers, and join producer completion plus readable retirement. Admit final identity validation independently; borrowed descriptors stay with their admitting owner, and failed owned closes retain their retry owner. The descriptor reader keeps a failed-read state until the physical failure is forwarded. Post-await checks prevent allocating streams after closure or cancellation.

The doctor cancellation fixture publishes a complete readiness record by rename, after installing its SIGTERM handler. This preserves strict PID/run-token, exit-status, and cleanup assertions.

Current-main alignment

Normally merged latest main 2237f936f0059ccba1d02afb0f1ba134d375ed62 into this same PR, head ecadb018a065a6b171dc8526410cce752a279d9e. This follow-up merge was conflict-free and retains the six-file final diff. The earlier reader conflict resolution preserves both the lifecycle scope and main's traversal coverage callback; the doctor fixture retains handler-before-readiness ordering. Main's accepted Kuna child-exit ordering and fake-Hopper contract repair (#10734) are included unchanged, with no competing patch.

Fresh final-tree qualification reran the exact five-suite selection below: 108 passed, no skips, exit 0, under the local-only subreaper (six adopted children reaped). npm run check:fast passed with both tasks executed; normal commit/pre-push hooks and final diff checks passed. New-head hosted CI is pending. The historical hosted and initial local failures below remain evidence for their executed revisions, not failures or successes of this new head.

Reproduction and validation

Historical original-fix evidence, on unchanged 8578daf8b production with the regression files: 17 failed / 78 passed, plus one uncaught cancellation error. Restoring the production files and applying the fix produced 15 suites / 353 passed, including compiled CLI/stdio MCP and sibling artifact consumers. These are historical results, not current-head executions.

Current final tree, Linux x64, Node 24.22.1, npm 11.16.0:

  • npm run test:focused -- tests/boundary/filesystem/inesArtifact.test.ts tests/boundary/filesystem/inesCancellation.test.ts tests/boundary/filesystem/fileHandleChunks.test.ts tests/boundary/cli/doctorCancellation.test.ts tests/boundary/providers/kuna/kunaVersionProbeOwnership.test.ts: 5 suites / 108 passed, no skips, exit 0. Executed through a local-only Linux subreaper wrapper that reaps this command's adopted child processes; it is not repository code and changes no test assertion, deadline, or selection.
  • The initial unwrapped selection produced 103 passed / 5 failed: Kuna process-group cleanup checks found killed grandchildren left as zombies under this container's non-reaping PID 1. Process inspection confirmed the zombie state. The subreaper qualification addresses that host limitation; it does not erase the initial failures. An isolated complete Kuna suite also passed 7/7 under the wrapper.
  • npm run check:fast: passed. Normal commit and pre-push hooks and final diff checks passed.

No fresh complete monolithic check, native Windows/macOS, real Hopper application, or emulator execution is claimed. Hosted CI at this new head is pending; local fixture passes do not establish real-provider behavior or hosted success.

History

Replaces #10152 at the author's request; that closed PR preserves the original review and CI history. Its two actionable automated findings remain included here. This update preserves the existing initial human readiness declaration without claiming a new human review of the follow-up.

Author readiness

Human owner: @ShuaixinHuang

The human owner explicitly confirmed review of this replacement’s final diff and current-base evidence on 2026-11-14 for head 4f6d85635b5cc8236fcf2ba54a835d72623f5c98, and declared it ready for initial maintainer review.

  • 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

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-14T14:42:55.639118Z
We couldn’t complete this review. Comment @codex review to try again.
4f6d856 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@greptile-apps

greptile-apps Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

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

Summary

The PR makes iNES readers wait for admitted reads, stream retirement, and final source checks before releasing an owned descriptor.

  • The iNES reader waits for its streams and checks before closing an owned descriptor.
  • A rejected descriptor read keeps its original error when cancellation races it.
  • The doctor cancellation fixture publishes readiness after installing its signal handler.

The review used the full PR changes because the current and previous review commits have different merge bases with the supplied target commit.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Reader admits work] --> B[Read region bytes]
  B --> C[Check byte count and source]
  D[Caller closes reader] --> E[Stop region producers]
  E --> F[Wait for admitted work and stream retirement]
  C --> F
  F --> G{Reader owns descriptor?}
  G -->|No| H[Leave descriptor with caller]
  G -->|Yes| I[Close owned descriptor]
  I -->|Close fails| J[Retain reader for retry]
Loading

Reviews (5) · Last reviewed commit: "fix(ci): sync accepted main fixes for PR..." · Reviewed by Greptile

Copy link
Copy Markdown
Contributor Author

@morluto Could you please review this iNES lifecycle and I/O-failure fix? Author readiness is complete. The regressions reproduce 17 failures on the unchanged tested base (8578daf8b), and all 353 focused tests pass with the fix, including compiled CLI and stdio MCP coverage. The earlier actionable feedback from #10152 is already incorporated. Thank you for your time.

@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.

2 participants