Skip to content

fix(skills): keep archive abort errors observed before reading - #26246

Merged
nwparker merged 1 commit into
mainfrom
nwparker/skill-archive-late-abort-observer
Oct 7, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/skill-archive-late-abort-observer

Conversation

@nwparker

@nwparker nwparker commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

A rejected skill extraction could also raise an uncaught stream error. The caller now receives the original rejection without that extra unhandled error.

What Changed

Keep an error listener on the archive’s gunzip stream from construction through abort. A small archive can finish its pipeline before extraction rejects a conflicting staging directory; the reader has not started yet and has no error listener. The existing pipeline and reader still reject normally. Add a real gzip regression that waits for pipeline completion, aborts before the first read, and checks the reader rejects with the exact original error.

Why

This fixes stream error ownership at its source rather than suppressing test errors, delaying extraction, or changing validation. The failure appeared in full CI for #26237; the archive sources are unchanged by that import PR. The focused regression reproduces on both Bun and Node, so this is not claimed as a Bun-only defect.

Linked Issue

Internal maintainer correction discovered while validating #26237. The template’s maintainer exception applies; no needless separate issue was created.

Visual Proof

N/A — archive error handling has no visual or interaction change.

Testing

Before/after measurements below use the same 15 named cases and the same real gzip regression. These are correctness measurements, not a speed claim.

Runtime Before After Improvement
Bun 1.4.2 15 passed; 1 uncaught EEXIST; exit 1 15 passed; 0 unhandled errors; exit 0 Eliminates the uncaught error; preserves exact reader rejection
Actual Node 15 passed; 1 uncaught EEXIST; exit 1 15 passed; 0 unhandled errors; exit 0 Same
  • Broader archive, gzip, extraction, package identity and manifest checks: 7 files / 75 cases pass under both Bun and actual Node, shuffled with seed 104729, isolation retained and filesystem module cache disabled.

  • pnpm tc:node, pnpm run check:code-quality:changed, formatting and diff checks pass on macOS. Linux/Windows CI checks now pass; paths use existing Node platform-neutral APIs. Local and SSH extraction share the same archive reader.

  • The first two diagnostic attempts encountered an existing custom reporter error while formatting the uncaught exception. Both remain recorded; the before/after table uses fresh stock default + JSON reporter runs. Stock JSON alone says success despite an uncaught exception; normal exit codes and default logs are included in the qualification.

  • Full PR CI run 37648372465 passed on tested source 0f29c3727360bbd5c6af5500ed68cf9a46a401ba (base 76d1b7bf29932f6e1edfb6b0b34d65c5c88e5f55, exact head 2dbda592eda87a28bf6e390a3d3f3d848a7d1f33). All 11,678 physical files were assigned and reported exactly once: 11,538 passed, 140 stock-skipped; 112,610 passed cases, one expected-failure case, 1,052 stock-skipped cases, zero failed files or unhandled errors. All five unit shards and 29 indexed checks passed, including Windows/Linux checks. The changed archive suite reported all 15 cases passed under the Bun project. Stock artifacts lack full named-case maps, so full CI establishes enrollment/counts rather than named-case identity parity; focused runs above supply that parity. All 18 stock configuration/routing/source guards and both changed files match the tested source. No assertion, timeout or unhandled-error guard is weakened.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Review

Independent source and focused evidence review passed against exact head 2dbda592eda87a28bf6e390a3d3f3d848a7d1f33: all focused and broader named-case maps match, source fingerprints remain stable and original reader rejection is preserved. CodeRabbit’s exact-head review generated zero actionable comments and no unresolved review threads. Its generic 80% docstring-coverage advisory was evaluated: the concise late-abort comment explains the non-obvious reason, and boilerplate documentation for the two touched functions would conflict with repository comment guidance. Its linked-issue advisory is covered by the internal maintainer exception above. Full CI and independent enrollment/source checks passed.

Agent skill upstream boundary

  • Not applicable; no upstream skill source is copied or translated.

Notes

Only the owned gunzip stream gets the listener. Compressed-size limits, archive identity, path checks, staging rules and cleanup remain in the existing extraction code. The regression uses an owned temporary directory and real stream completion rather than a guessed delay.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • N/A visual proof explained
  • Self-reviewed for correctness, security, and performance
  • Cross-platform and SSH impact considered
  • Focused tests and typecheck/changed-quality gates pass; full CI integration passes

@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a92c66b1-3713-486d-be7c-287fd14dbc1e
📥 Commits

Reviewing files that changed from the base of the PR and between 76d1b7b and 2dbda59.

📒 Files selected for processing (2)
  • src/main/skills/skill-package-tar.test.ts
  • src/main/skills/skill-package-tar.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

openSkillTarGzip now registers an error listener on the gunzip stream before starting the archive pipeline. A regression test aborts a gzip tar archive with an EEXIST error before the reader’s first request. It verifies that readExact rejects with that error and removes the temporary directory.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 2dbda

The early-abort path retains error observation, and a focused Node reproduction confirms the reader receives the original error. No actionable merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the primary change: preserving archive abort errors before reading.
Description check ✅ Passed The description covers the required sections, explains the user-visible behavior and mechanism, identifies the cause, documents the maintainer exception for the linked issue, marks visual proof as not…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker
nwparker marked this pull request as draft October 7, 2026 15:58
@nwparker
nwparker marked this pull request as ready for review October 7, 2026 15:58
@nwparker
nwparker merged commit 7d6d7ca into main Oct 7, 2026
29 checks passed
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