Repository navigation
refactor(native): build debugger and native cancellations with a required reason - #10599
Merged
Merged
Conversation
Add cancelledBy, the one constructor for AnalysisCancelledError. Its reason argument is required: an aborted signal, an earlier cancellation, a reason carried from an inner failure, or an OwnerCancellation when REA closed the work's owner itself. Closed adb, apktool, firmware, sqlite, gdb, web-bundle analyzer and binary-session record owners now report OwnerCancellation.ownerClosed instead of an absent reason. Firmware's predecessor wait returns its cancellation as a Result, removing an unreachable reason-less fallback. An architecture guard rejects new direct constructions, with a counted per-file baseline that can only shrink.
…equired reason (#10587) Migrate every AnalysisCancelledError construction under src/ghidra, src/ida, src/cutter, src/jeb and src/kuna to cancelledBy and lower the guard baseline from 671 to 572. Closed Kuna target commands report OwnerCancellation.ownerClosed instead of an absent reason, and Kuna and JEB close abort their lifetimes with that typed reason.
…ired reason Migrate every AnalysisCancelledError construction under src/native, src/gdb and src/rizin to cancelledBy and delete Rizin's local rizinCancellation constructor; its reason choice becomes a CancellationReason. GDB close aborts active startups with OwnerCancellation.ownerClosed.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
11 tasks
Contributor
[Medium impact] The reviewed changes appear safe to merge; no blocking issue was found. SummaryMoves debugger and native cancellation construction to
Reviews (10) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile |
19 tasks
# Conflicts: # scripts/verify/architecture-guard-baselines.json # scripts/verify/architecture-guards.mjs
…o HEAD # Conflicts: # scripts/verify/architecture-guard-baselines.json # src/native/pe/PeBinaryFailure.ts # src/rizin/RizinDebugSessionManager.ts
# Conflicts: # scripts/verify/architecture-guard-baselines.json # src/gdb/GdbSessionManager.ts
# Conflicts: # scripts/verify/architecture-guard-baselines.json
…-reason-debuggers # Conflicts: # scripts/verify/architecture-guard-baselines.json # src/gdb/GdbSessionManager.ts
22 tasks
…-reason-debuggers # Conflicts: # scripts/verify/architecture-guard-baselines.json # src/native/pwntools/PwntoolsFailures.ts
…-reason-debuggers # Conflicts: # scripts/verify/architecture-guard-baselines.json # src/gdb/GdbSessionManager.ts
…-reason-debuggers # Conflicts: # scripts/verify/architecture-guard-baselines.json # src/gdb/GdbSessionManager.ts # src/rizin/RizinDebugSessionManager.ts
…-reason-debuggers # Conflicts: # scripts/verify/architecture-guard-baselines.json # src/native/LldbCallTracer.ts # src/native/SignatureTargetBinding.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrates every
AnalysisCancelledErrorconstruction undersrc/native/,src/gdb/andsrc/rizin/(59 sites) tocancelledBy, the reason-requiring owner from #10566, and deletes Rizin's localrizinCancellationconstructor. The guard baseline drops by 59, to 513 on the current base branch. Stacked onrefactor/cancellation-owner(#10566).Refs #8223
Overlap: #10551 (gdb retained cancellation) edits
GdbSessionManager.tsaround thegdb_consolecancellation and Rizin's#retainCleanupFailure, which this PR also touches. Whichever lands second needs a small rebase. If #10551 lands after the guard, its newnew AnalysisCancelledError(sites must usecancelledBy.Problem and expected behavior
rizinCancellation(operation, signal?, cause?, options)was a local constructor that chose the cause in this order: the caller's reason when the signal had aborted, otherwise an earlier cancellation's cause, otherwise the raw cause. It is replaced byrizinCancellationReason(signal, cause): CancellationReason. That helper makes the same choice in the owner's vocabulary (isAborted(signal) ? signal : earlier cancellation : carriedReason(cause)), and every construction now goes throughcancelledBy.cancelledWithCallerReasonkeeps its separate job (copying the earlier cancellation's diagnostics, output and cleanup), but now builds throughcancelledBy.GdbSessionManager.closeaborted active startups with no reason; it now aborts withOwnerCancellation.ownerClosed.Change and scope
new AnalysisCancelledError(op, { cause: s.reason, ...rest })becamecancelledBy(op, s, rest)whereversis a narrowedAbortSignal. Every other cause becamecarriedReason(x), which keeps the existing value.cause(GDB startupdetails/errorDetails,NativeCommandAnalysisError,LldbCallTracer,NativeMacOSProvider, Rizin#retainCleanupFailure) are split, so the cancellation branch receives nocause.AnalysisCancelledErroras their cause still wrap it, throughcarriedReason(cause). Whether to flatten that wrapper is a behaviour question for the GDB/Rizin drift work and is left unchanged here.cancelledexit, pwntools admission, Apple dispatch metadata) keepcarriedReason(signal?.reason).Contract and boundary impact
cancelledByandisAborted(refactor(errors): require a reason for every analysis cancellation #10566); the debugger and native adapters are consumers.causeis not projected.Expected effects: none checked. This changes error construction only.
Evidence and regression coverage
instanceof AbortSignal; the owner now matches signals structurally, with its own unit test on the base branch (fix(errors): read the reason of any signal-shaped cancellation source).Validation performed
npm run check:fast— passed (typecheck, lint).node scripts/verify/architecture-guards.mjs— passed; baseline 513 sites in 186 files, none undersrc/native/,src/gdb/orsrc/rizin/.npm run test:focused --the test files beside the changed modules, thetests/files that import a changed module and assert on cancellation orcause, and everytests/boundary/providers/Gdb*,Rizin*andtests/boundary/mcp/gdb*file (49 files):RizinDebugSessionCoverage.part3.test.ts(signal-shaped fake, see above);npx oxfmton changed files — formatted.main(b0e3257), 2026-11-15:GdbSessionManagerconflicts resolved onto main'sOwnedDebuggerSessionRegistryandclassifyLaunchFailureowners, keeping this PR'scancelledByconstruction.npm run check:fastpassed;node scripts/verify/architecture-guards.mjs --shrink-baselines, then the guard passed (it also lowered the staleMcpRegistrationGit.tsbindCleanupDependenciesentry, already 0 on main);npm run test:focused --GdbSessionReviewRegressions,GdbSessionManagers,GdbSessionManagerCoverage,gdbCancellationMcp,debuggerSessionLimits: 249 tests passed.Compatibility, safety, and release
Author readiness
Human owner:
Before merge
type(scope): outcome.