Skip to content

fix(cli): cancel routed JavaScript analysis in rea analyze - #1156

Merged
morluto merged 1 commit into
mainfrom
fix/cli-analyze-javascript-cancellation
Oct 9, 2026
Merged

morluto merged 1 commit into
mainfrom
fix/cli-analyze-javascript-cancellation

Conversation

@kaoru0822-kitauji

Copy link
Copy Markdown
Collaborator

Problem

rea analyze PATH routes a JavaScript directory or .asar (with no --provider, --snapshot or --target-format) to the same static analysis as rea analyze-javascript-application. That route passed no AbortSignal and was not wrapped in withCommandCancellation. The #1098 review raised this ("Propagate cancellation through the routed analyze command"), and it was still unaddressed on main.

I reproduced it by sending SIGINT at the first rea_progress line, the same scenario as javascriptCancellationCli.test.ts:

Command Exit stdout
rea analyze-javascript-application <dir> --json code 130 typed {"code":"cancelled",…}
rea analyze <dir> --json (before) killed by SIGINT empty
rea analyze <dir> --json (after) code 130 typed {"code":"cancelled",…}

Change

  • The analyze command now picks its route before running. The routing condition is unchanged, moved into routesToJavaScriptAnalysis.
  • A JavaScript target runs exactly like the dedicated command: withCommandCancellation wraps logCliCommand, so the cancelled exit code 130 is not replaced by the logged failure status of 1, which would happen if the wrapping were reversed.
  • The binary route is unchanged and keeps the SIGINT handling inside runDirectAnalysis.

Verification

  • tests/acceptance/applications/javascriptCancellationCli.test.ts now runs the SIGINT case through both analyze-javascript-application and analyze. The analyze case fails on main.
  • All 13 test files that reference the analyze command, coreBinaryCommands or analyze-javascript-application: 72 passed.
  • npm run check:fast
  • Manually, rea analyze <js-dir> without SIGINT still returns the analysis Evidence, and rea analyze /bin/ls still takes the provider route.

No real Hopper or Ghidra verification was run. The binary route those providers use is unchanged.

🤖 Generated with Claude Code

`rea analyze PATH` routes a JavaScript directory or ASAR to the same
static analysis as `rea analyze-javascript-application`, but it passed
no signal and was not wrapped in withCommandCancellation. On SIGINT the
process was killed with no output (signal SIGINT, empty stdout).
The dedicated command returns a typed `cancelled` result and exits 130.
The #1098 review raised this route.

Decide the route first. A JavaScript target now runs exactly like the
dedicated command: cancellation wraps logging, so the cancelled exit
code is not replaced by the logged failure status. The binary route is
unchanged and keeps its own SIGINT handling in runDirectAnalysis.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T01:45:43.532511Z 51fe12f 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.

@morluto
morluto merged commit 089bbf5 into main Oct 9, 2026
22 checks passed
@morluto
morluto deleted the fix/cli-analyze-javascript-cancellation branch October 9, 2026 01:48
darsrc pushed a commit to darsrc/rea that referenced this pull request Oct 10, 2026
)

`rea analyze PATH` routes a JavaScript directory or ASAR to the same
static analysis as `rea analyze-javascript-application`, but it passed
no signal and was not wrapped in withCommandCancellation. On SIGINT the
process was killed with no output (signal SIGINT, empty stdout).
The dedicated command returns a typed `cancelled` result and exits 130.
The morluto#1098 review raised this route.

Decide the route first. A JavaScript target now runs exactly like the
dedicated command: cancellation wraps logging, so the cancelled exit
code is not replaced by the logged failure status. The binary route is
unchanged and keeps its own SIGINT handling in runDirectAnalysis.
@morluto morluto added bug Something isn't working area: cli CLI adapter and one-shot commands labels Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli CLI adapter and one-shot commands bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants