[GH-ISSUE #1968] Cancellation after the last selected JavaScript source misreports the next unselected file as cancelled #657

Closed
opened 2026-10-15 18:27:01 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @kaoru0822-kitauji on GitHub (Oct 11, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/1968

Observed behavior

With source_paths, analyzeAndAdoptJavaScriptArtifactFiles (src/application/javascript/JavaScriptArtifactAnalysis.ts) checks signal.aborted at the top of each file iteration, before it recognizes an outside-analysis-scope file. If cancellation arrives after the last selected source completes and before the loop reaches the first unselected file, the abort check throws. The catch block then records that unselected file with an analysis_failure of cancelled, plus a cancellation-derived semantic unknown. Because the file is now in analyzedPaths, the completion loop, which classifies the other unselected files correctly, skips it.

The partial Evidence then reports that one file's analysis was cancelled, when the caller excluded it from the selection.

Raised by Codex on #1944 (P2, "Classify omitted files before checking cancellation"); still present on main 1d4c4eb03.

Reproduction

A boundary test on writeJavaScriptSourceSelectionFixture reads the file set with source_paths: ["main.mjs"]. It then runs analyzeAndAdoptJavaScriptArtifactFiles with the real worker, aborting right after main.mjs returns. The result has interruption = AnalysisCancelledError, and one of the five outside-analysis-scope files carries:

analysis_failure: { error: { code: "cancelled", ... } }

Expected behavior

Every unselected file stays classified as outside the caller-selected source_paths, with no analysis_failure, while the overall cancellation is still reported as the interruption. The out-of-scope classification, currently written separately in the main loop and the completion loop, should have one owner.

Originally created by @kaoru0822-kitauji on GitHub (Oct 11, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/1968 ### Observed behavior With `source_paths`, `analyzeAndAdoptJavaScriptArtifactFiles` (`src/application/javascript/JavaScriptArtifactAnalysis.ts`) checks `signal.aborted` at the top of each file iteration, before it recognizes an `outside-analysis-scope` file. If cancellation arrives after the last selected source completes and before the loop reaches the first unselected file, the abort check throws. The `catch` block then records that unselected file with an `analysis_failure` of `cancelled`, plus a cancellation-derived semantic unknown. Because the file is now in `analyzedPaths`, the completion loop, which classifies the other unselected files correctly, skips it. The partial Evidence then reports that one file's analysis was cancelled, when the caller excluded it from the selection. Raised by Codex on #1944 (P2, "Classify omitted files before checking cancellation"); still present on main `1d4c4eb03`. ### Reproduction A boundary test on `writeJavaScriptSourceSelectionFixture` reads the file set with `source_paths: ["main.mjs"]`. It then runs `analyzeAndAdoptJavaScriptArtifactFiles` with the real worker, aborting right after `main.mjs` returns. The result has `interruption` = `AnalysisCancelledError`, and one of the five `outside-analysis-scope` files carries: ```text analysis_failure: { error: { code: "cancelled", ... } } ``` ### Expected behavior Every unselected file stays classified as outside the caller-selected `source_paths`, with no `analysis_failure`, while the overall cancellation is still reported as the interruption. The out-of-scope classification, currently written separately in the main loop and the completion loop, should have one owner.
bsakaguchi 2026-10-15 18:27:01 +00:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@kaoru0822-kitauji commented on GitHub (Oct 11, 2026):

Fixed on main by 7285e1583. Verified: the boundary repro from #1975 (cancel right after the only selected source returns) now leaves all five unselected files without an analysis_failure, and the interruption is still AnalysisCancelledError.

<!-- gh-comment-id:6114635236 --> @kaoru0822-kitauji commented on GitHub (Oct 11, 2026): Fixed on main by 7285e1583. Verified: the boundary repro from #1975 (cancel right after the only selected source returns) now leaves all five unselected files without an `analysis_failure`, and the interruption is still `AnalysisCancelledError`.
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#657
No description provided.