[GH-ISSUE #4610] [Bug] main CI red since e65c3955f: binaryTargetAdmissionCancellation and managedHashCancellation fail #2395

Closed
opened 2026-10-17 21:04:07 +00:00 by bsakaguchi · 5 comments
Owner

Originally created by @Nitin13-git on GitHub (Oct 16, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/4610

Before submitting

  • I searched the open and closed issues for a related report.
  • I removed credentials, tokens, private paths, and sensitive target data.

Area

Evidence, artifacts, or reconstruction

Observed behavior

Two tests fail on main since e65c3955f ("fix(filesystem): preserve digest failures through cleanup cancellation"); main's CI is red from that commit on (cd9252bc6, 67384b23e, 1b56237ca), and unrelated PRs (for example #4602) fail the same two tests.

  1. tests/process-global/binaryTargetAdmissionCancellation.test.ts, "retains the cleanup failure and its file owner when cancelled admission cannot close". expect(failure.cause).toBe(reason) fails: failure.cause is a RegularFileOperationCancelled (with reason: Error("caller cancelled")), while the test expects the caller's Error("caller cancelled") itself.
  2. tests/boundary/providers/managed/managedHashCancellation.test.ts, "cancels a cached managed source hash and recovers its exact owner (close denied: false, reason: cleanup)". The retry fails with ProviderCleanupError: "Artifact cleanup remains incomplete" caused by "File handle was invalidated before this owner confirmed its close" (OwnedFileHandle.close, fd: -1) from retryRegularFileCleanup in RegularFileRead.ts.

Reproduction

Executed locally on macOS arm64, Node 24.18.0, locked dependencies:

git checkout --detach <commit>
npm run test:focused -- tests/process-global/binaryTargetAdmissionCancellation.test.ts tests/boundary/providers/managed/managedHashCancellation.test.ts
  • 0d2247428: 17 passed.
  • e65c3955f: 2 failed, 15 passed (the two tests above).
  • Later commits: the first test fails on cd9252bc6, the second fails on 1b56237ca (three of three runs), and both fail together on 36062643.

CI shows the same failures (shard 1/5 for the first, shard 5/5 for the second).

Expected behavior

main is green. Either the code at e65c3955f restores what these tests assert (cause identity and retry of a failed descriptor close), or the tests are updated to the new contract if the wrapper type and handle invalidation are intended.

Impact and scope

Observed: CI is red on main and on PRs that do not touch this code, so they cannot reach CI required. Not established: which side (code or tests) should change, whether other tests are affected, or whether Windows behaves the same. I did not inspect the commit's design beyond the files it changes (src/application/RegularFileRead.ts, src/artifacts/ArtifactFileOperation.ts, and others).

REA version

6.5.0 at e65c3955f through 36062643.

Runtime and platform

macOS arm64, Node 24.18.0 (CI: GitHub Linux runners)

Target and artifact context

NOT_ENOUGH_INFO: test-only reproduction; no target artifact involved.

Interface

Other

Earliest failure stage

Cleanup, cancellation, or lifecycle

Relevant output or evidence

First test: AssertionError: expected RegularFileOperationCancelled: Regular fi… { …(2) } to be Error: caller cancelled // Object.is equality at binaryTargetAdmissionCancellation.test.ts:158.

Second test: Error: Provider rea-dotnet-static adapter failed during inspect_managed_members, caused by ArtifactReaderFailure: Artifact cleanup remains incomplete: .../other-input.dll, caused by Error: File handle was invalidated before this owner confirmed its close (OwnedFileHandle.close, called from ArtifactResourceScope.release via retryRegularFileCleanup).

Analysis or suspected cause

Hypothesis, not verified: e65c3955f changed how cancellation and descriptor cleanup are projected in RegularFileRead.ts and ArtifactFileOperation.ts; the tests were written against the earlier shape. The bisect above narrows the break to that commit's parent and itself, but I have not read it closely enough to say whether code or tests are wrong. Possibly related, not claimed: open PR #4438 also edits withRegularFileOwned.

Originally created by @Nitin13-git on GitHub (Oct 16, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/4610 ### Before submitting - [x] I searched the open and closed issues for a related report. - [x] I removed credentials, tokens, private paths, and sensitive target data. ### Area Evidence, artifacts, or reconstruction ### Observed behavior Two tests fail on `main` since `e65c3955f` ("fix(filesystem): preserve digest failures through cleanup cancellation"); `main`'s CI is red from that commit on (`cd9252bc6`, `67384b23e`, `1b56237ca`), and unrelated PRs (for example #4602) fail the same two tests. 1. `tests/process-global/binaryTargetAdmissionCancellation.test.ts`, "retains the cleanup failure and its file owner when cancelled admission cannot close". `expect(failure.cause).toBe(reason)` fails: `failure.cause` is a `RegularFileOperationCancelled` (with `reason: Error("caller cancelled")`), while the test expects the caller's `Error("caller cancelled")` itself. 2. `tests/boundary/providers/managed/managedHashCancellation.test.ts`, "cancels a cached managed source hash and recovers its exact owner (close denied: false, reason: cleanup)". The retry fails with `ProviderCleanupError`: "Artifact cleanup remains incomplete" caused by "File handle was invalidated before this owner confirmed its close" (`OwnedFileHandle.close`, `fd: -1`) from `retryRegularFileCleanup` in `RegularFileRead.ts`. ### Reproduction Executed locally on macOS arm64, Node 24.18.0, locked dependencies: ```sh git checkout --detach <commit> npm run test:focused -- tests/process-global/binaryTargetAdmissionCancellation.test.ts tests/boundary/providers/managed/managedHashCancellation.test.ts ``` - `0d2247428`: 17 passed. - `e65c3955f`: 2 failed, 15 passed (the two tests above). - Later commits: the first test fails on `cd9252bc6`, the second fails on `1b56237ca` (three of three runs), and both fail together on `36062643`. CI shows the same failures (shard 1/5 for the first, shard 5/5 for the second). ### Expected behavior `main` is green. Either the code at `e65c3955f` restores what these tests assert (cause identity and retry of a failed descriptor close), or the tests are updated to the new contract if the wrapper type and handle invalidation are intended. ### Impact and scope Observed: CI is red on `main` and on PRs that do not touch this code, so they cannot reach `CI required`. Not established: which side (code or tests) should change, whether other tests are affected, or whether Windows behaves the same. I did not inspect the commit's design beyond the files it changes (`src/application/RegularFileRead.ts`, `src/artifacts/ArtifactFileOperation.ts`, and others). ### REA version 6.5.0 at `e65c3955f` through `36062643`. ### Runtime and platform macOS arm64, Node 24.18.0 (CI: GitHub Linux runners) ### Target and artifact context NOT_ENOUGH_INFO: test-only reproduction; no target artifact involved. ### Interface Other ### Earliest failure stage Cleanup, cancellation, or lifecycle ### Relevant output or evidence First test: `AssertionError: expected RegularFileOperationCancelled: Regular fi… { …(2) } to be Error: caller cancelled // Object.is equality` at `binaryTargetAdmissionCancellation.test.ts:158`. Second test: `Error: Provider rea-dotnet-static adapter failed during inspect_managed_members`, caused by `ArtifactReaderFailure: Artifact cleanup remains incomplete: .../other-input.dll`, caused by `Error: File handle was invalidated before this owner confirmed its close` (`OwnedFileHandle.close`, called from `ArtifactResourceScope.release` via `retryRegularFileCleanup`). ### Analysis or suspected cause Hypothesis, not verified: `e65c3955f` changed how cancellation and descriptor cleanup are projected in `RegularFileRead.ts` and `ArtifactFileOperation.ts`; the tests were written against the earlier shape. The bisect above narrows the break to that commit's parent and itself, but I have not read it closely enough to say whether code or tests are wrong. Possibly related, not claimed: open PR #4438 also edits `withRegularFileOwned`.
Author
Owner

@morluto commented on GitHub (Oct 17, 2026):

Reproduced both reported failures on Node 24.18.0 at 0c7b6d834: 2 failed, 15 passed.

Two distinct causes:

  • The admission test expected a raw caller reason after the existing boundary changed to an explicit RegularFileOperationCancelled checkpoint. 3bd9aa348 asserts that wrapper and exact original reason while retaining the descriptor/cleanup checks.
  • withRegularFile interpreted an opaque caller reason shaped like RegularFileCleanupFailure as this operation's cleanup record and retried a foreign descriptor. 746a044e4 preserves the exact reason before class interpretation, including checkpoint-shaped reasons after a successful close retry. Signal-aware reference-source and capture-export cleanup consumers now carry the same context.

Validation: 156 focused tests passed across 14 files, covering the two reported files, opaque reason identity, foreign descriptor ownership, cleanup retry, nested cancellation, physical failure precedence, and affected ADB/JADX/Kuna/reference-source/export consumers. These are local production-boundary tests with controlled faults; no native provider behavior is claimed. The heavy Qodo/profiler test remained stopped. Full CI results remain separate.

The filesystem owner primitive remains unchanged: signal equality is not used to replace a physical failure with cancellation.

<!-- gh-comment-id:6227306518 --> @morluto commented on GitHub (Oct 17, 2026): Reproduced both reported failures on Node 24.18.0 at `0c7b6d834`: 2 failed, 15 passed. Two distinct causes: - The admission test expected a raw caller reason after the existing boundary changed to an explicit `RegularFileOperationCancelled` checkpoint. `3bd9aa348` asserts that wrapper and exact original reason while retaining the descriptor/cleanup checks. - `withRegularFile` interpreted an opaque caller reason shaped like `RegularFileCleanupFailure` as this operation's cleanup record and retried a foreign descriptor. `746a044e4` preserves the exact reason before class interpretation, including checkpoint-shaped reasons after a successful close retry. Signal-aware reference-source and capture-export cleanup consumers now carry the same context. Validation: 156 focused tests passed across 14 files, covering the two reported files, opaque reason identity, foreign descriptor ownership, cleanup retry, nested cancellation, physical failure precedence, and affected ADB/JADX/Kuna/reference-source/export consumers. These are local production-boundary tests with controlled faults; no native provider behavior is claimed. The heavy Qodo/profiler test remained stopped. Full CI results remain separate. The filesystem owner primitive remains unchanged: signal equality is not used to replace a physical failure with cancellation.
Author
Owner

@Nitin13-git commented on GitHub (Oct 17, 2026):

@morluto thanks for the fixes. One more failure from the same commit range: with 3bd9aa348 and 746a044e4 the two reported tests pass, but main CI still fails tests/boundary/providers/kuna/kunaProvider.test.ts ("waits for an aborted pre-session hash before retrying its late close owner").

It expects error: { _tag: "ProviderAdapterError", cleanupIncomplete: true } but receives an AnalysisCancelledError (with cleanupIncomplete: true).

Bisect on a local checkout (macOS, Node 24.18.0, npm run test:focused -- tests/boundary/providers/kuna/kunaProvider.test.ts):

  • passes at 0d2247428 (31 passed);
  • fails at e65c3955f, and at cd9252bc6, 360626434, d5be402fb, 0c7b6d834, 3bd9aa348, 746a044e4 and bfb7ed0bd (current origin/main).

The test file is unchanged between 0d2247428 and main, while e65c3955f also changed src/kuna/* (KunaCommand, KunaInstallation, KunaProjectCache, KunaProjectExport, KunaProvider, KunaSessionClient). I have not checked whether the test or the code should change; the new result may be intended given the cancellation changes in that commit.

<!-- gh-comment-id:6227491825 --> @Nitin13-git commented on GitHub (Oct 17, 2026): @morluto thanks for the fixes. One more failure from the same commit range: with `3bd9aa348` and `746a044e4` the two reported tests pass, but `main` CI still fails `tests/boundary/providers/kuna/kunaProvider.test.ts` ("waits for an aborted pre-session hash before retrying its late close owner"). It expects `error: { _tag: "ProviderAdapterError", cleanupIncomplete: true }` but receives an `AnalysisCancelledError` (with `cleanupIncomplete: true`). Bisect on a local checkout (macOS, Node 24.18.0, `npm run test:focused -- tests/boundary/providers/kuna/kunaProvider.test.ts`): - passes at `0d2247428` (31 passed); - fails at `e65c3955f`, and at `cd9252bc6`, `360626434`, `d5be402fb`, `0c7b6d834`, `3bd9aa348`, `746a044e4` and `bfb7ed0bd` (current `origin/main`). The test file is unchanged between `0d2247428` and `main`, while `e65c3955f` also changed `src/kuna/*` (`KunaCommand`, `KunaInstallation`, `KunaProjectCache`, `KunaProjectExport`, `KunaProvider`, `KunaSessionClient`). I have not checked whether the test or the code should change; the new result may be intended given the cancellation changes in that commit.
Author
Owner

@Nitin13-git commented on GitHub (Oct 17, 2026):

Follow-up with CI evidence for the Kuna failure above:

  • Run at 746a044e (includes 3bd9aa348 and 746a044e4): https://github.com/morluto/rea/actions/runs/38986298607. Test shard (4/5) and Portable tests fail only on tests/boundary/providers/kuna/kunaProvider.test.ts > waits for an aborted pre-session hash before retrying its late close owner (no other FAIL line in those jobs).
  • Run at 0c7b6d83 (before those two fixes): https://github.com/morluto/rea/actions/runs/38981672194. The same Kuna test fails there too, together with managedHashCancellation, binaryTargetAdmissionCancellation, and tests/boundary/mcp/serverIdentity.test.ts > live server identity over MCP > compares the caller's digest against the selected compact tools/list catalog (I did not look into that last one).
  • Assertion, from the CI log (kunaProvider.test.ts:154): expected { ok: false, error: { _tag: "ProviderAdapterError", cleanupIncomplete: true } }, received { ok: false, error: AnalysisCancelledError { _tag: "AnalysisCancelledError", cleanupIncomplete: true } }. The test aborts the signal while the profile close is held, releases the close, then awaits previewTarget.

I have not identified which of the src/kuna/* changes in e65c3955f produces the cancellation.

<!-- gh-comment-id:6227548438 --> @Nitin13-git commented on GitHub (Oct 17, 2026): Follow-up with CI evidence for the Kuna failure above: - Run at `746a044e` (includes `3bd9aa348` and `746a044e4`): https://github.com/morluto/rea/actions/runs/38986298607. `Test shard (4/5)` and `Portable tests` fail only on `tests/boundary/providers/kuna/kunaProvider.test.ts > waits for an aborted pre-session hash before retrying its late close owner` (no other `FAIL` line in those jobs). - Run at `0c7b6d83` (before those two fixes): https://github.com/morluto/rea/actions/runs/38981672194. The same Kuna test fails there too, together with `managedHashCancellation`, `binaryTargetAdmissionCancellation`, and `tests/boundary/mcp/serverIdentity.test.ts > live server identity over MCP > compares the caller's digest against the selected compact tools/list catalog` (I did not look into that last one). - Assertion, from the CI log (`kunaProvider.test.ts:154`): expected `{ ok: false, error: { _tag: "ProviderAdapterError", cleanupIncomplete: true } }`, received `{ ok: false, error: AnalysisCancelledError { _tag: "AnalysisCancelledError", cleanupIncomplete: true } }`. The test aborts the signal while the profile close is held, releases the close, then awaits `previewTarget`. I have not identified which of the `src/kuna/*` changes in `e65c3955f` produces the cancellation.
Author
Owner

@CassieFox23 commented on GitHub (Oct 18, 2026):

Checked on Linux: part of this is fixed on main by 3bd9aa348 and 746a044e4. Their messages say "Refs #4610", which is why GitHub left this issue open.

  • tests/process-global/binaryTargetAdmissionCancellation.test.ts and tests/boundary/filesystem/regularFileCancellation.test.ts pass on main 36d156ff0 on Node 22.23.1, 24.18.0 and 26.11.1 (49 tests).
  • With 746a044e4 reverted on main, 5 tests fail. With 3bd9aa348 reverted, 1 fails.

The issue wants a green main. At 36d156ff0 main CI was red on a different test, tests/boundary/mcp/nativeUiFinalizationMcp.test.ts, reported on #5056. So part of this may still be open.

Thanks, Nitin13-git, for the clear report.

🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊

<!-- gh-comment-id:6254894346 --> @CassieFox23 commented on GitHub (Oct 18, 2026): Checked on Linux: part of this is fixed on main by 3bd9aa348 and 746a044e4. Their messages say "Refs #4610", which is why GitHub left this issue open. - `tests/process-global/binaryTargetAdmissionCancellation.test.ts` and `tests/boundary/filesystem/regularFileCancellation.test.ts` pass on main 36d156ff0 on Node 22.23.1, 24.18.0 and 26.11.1 (49 tests). - With 746a044e4 reverted on main, 5 tests fail. With 3bd9aa348 reverted, 1 fails. The issue wants a green main. At 36d156ff0 main CI was red on a different test, `tests/boundary/mcp/nativeUiFinalizationMcp.test.ts`, reported on #5056. So part of this may still be open. Thanks, Nitin13-git, for the clear report. 🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊
Author
Owner

@morluto commented on GitHub (Oct 18, 2026):

Closing as fixed on main after reconciling this report with the landed owner/consumer changes.

  • 746a044e4: fix(filesystem): preserve opaque caller reasons through cleanup. Validation: 156 focused tests across 14 files passed; no native provider execution. Refs #4610
  • 3bd9aa348: test(filesystem): assert admission cancellation provenance.

Evidence scope: this closure uses the landed source, regression coverage and validation already recorded in the linked commits/thread. No new local tests or native-provider reproduction were run during this backlog pass; previously documented platform and real-provider gaps still apply.

<!-- gh-comment-id:6255997796 --> @morluto commented on GitHub (Oct 18, 2026): <!-- rea-backlog-reconciliation-2026-10-19-4610 --> Closing as fixed on `main` after reconciling this report with the landed owner/consumer changes. - [746a044e4](https://github.com/morluto/rea/commit/746a044e42c9eeff76a26d24c7dc89ae0eeff88d): fix(filesystem): preserve opaque caller reasons through cleanup. Validation: 156 focused tests across 14 files passed; no native provider execution. Refs #4610 - [3bd9aa348](https://github.com/morluto/rea/commit/3bd9aa348478eebfd339219d8e1ecee07f635333): test(filesystem): assert admission cancellation provenance. Evidence scope: this closure uses the landed source, regression coverage and validation already recorded in the linked commits/thread. No new local tests or native-provider reproduction were run during this backlog pass; previously documented platform and real-provider gaps still apply.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#2395
No description provided.