Repository navigation
refactor(application): build application cancellations with a required reason - #10574
Merged
Merged
Conversation
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. |
morluto
force-pushed
the
refactor/cancellation-reason-application
branch
from
November 14, 2026 15:30
478ca66 to
2e21450
Compare
Contributor
[Medium impact] The reviewed changes appear safe to merge; no new actionable defects or rule violations were found. SummaryMigrates application cancellation construction to
Reviews (13) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile |
11 tasks
morluto
force-pushed
the
refactor/cancellation-reason-application
branch
from
November 14, 2026 15:39
2e21450 to
e811803
Compare
11 tasks
morluto
force-pushed
the
refactor/cancellation-reason-application
branch
from
November 14, 2026 16:13
e811803 to
5f6bba1
Compare
19 tasks
…d reason Migrate every AnalysisCancelledError construction under src/application to cancelledBy and lower the guard baseline from 671 to 442. Shutdown refusals in BinarySession report OwnerCancellation.ownerClosed when the caller did not abort, instead of an undefined reason. ReverseEngineeringService and DesktopBuildOwnedWork close their work with the typed owner reason. SharedStartupAttempt returns the departing caller's reason with a cancelled wait. One shared isAborted predicate replaces eleven local copies and narrows a checked signal for cancelledBy.
morluto
force-pushed
the
refactor/cancellation-reason-application
branch
from
November 14, 2026 20:34
ba875a1 to
487ec71
Compare
# Conflicts: # scripts/verify/architecture-guard-baselines.json
…-reason-application # Conflicts: # src/application/McpRegistrationGit.ts
This was referenced Nov 15, 2026
Merged
22 tasks
…-reason-application # Conflicts: # scripts/verify/architecture-guard-baselines.json
…-reason-application # Conflicts: # src/application/EnhancedTools.ts # src/application/XrefsAddressResolution.ts
…-reason-application # Conflicts: # src/application/DirectAnalysis.ts # src/application/Doctor.ts # src/application/binary/BinarySession.ts # src/application/reverse/ReverseEngineeringService.ts
…-reason-application # Conflicts: # scripts/verify/architecture-guard-baselines.json # src/application/EvidenceBundleCommands.ts
…-reason-application # Conflicts: # scripts/verify/architecture-guard-baselines.json # src/application/binary/AnalysisProviderEvaluation.ts
…-reason-application # Conflicts: # src/application/process/ProcessCli.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/application/(229 sites) tocancelledBy, the reason-requiring owner added in #10566, and lowers the guard baseline from 671 to 442. Stacked on #10566 (its base branch); retarget tomainafter #10566 merges.Refs #8223
Problem and expected behavior
Several application paths built a cancellation whose reason could be absent:
BinarySessionrefused work afterbeginShutdown()withcause: signal?.reason, which isundefinedwhenever the caller had not aborted. These now report the caller's reason when the caller aborted, andOwnerCancellation.ownerClosedotherwise.ReverseEngineeringServiceclosed its active operations withcontroller.abort(). Each operation then reported a genericAbortErroras its cancellation reason. Close now aborts withOwnerCancellation.ownerClosed.DesktopBuildOwnedWorkused an ad hocnew Error("REA is closing its build computers")as its close reason; it now uses the typedOwnerCancellation.ownerClosed.AnalysisProviderRegistryrebuilt a departing caller's reason fromoptions.signal?.reasonafterSharedStartupAttempt.waitreportedcancelled. The wait result now carriesreason, the departing caller's own reason, and the registry uses it.Change and scope
new AnalysisCancelledError(op, { cause: s.reason, ...rest })becamecancelledBy(op, s, rest)whereversis typed as an aborted or non-optionalAbortSignal. Every other cause becamecarriedReason(x), which preserves the existing value exactly. A TypeScript-checker codemod did the rewrite;cause?: neverinCancelledOptionsmade each options spread that still carried a cause fail to compile until it was fixed (DesktopBuildComputers.startFailure).isAborted(signal): signal is AbortedSignalfrom refactor(errors): require a reason for every analysis cancellation #10566 replaces 11 localisAborted/signalIsAbortedcopies in application files, and its narrowing lets a checked signal go straight tocancelledBy.cancelledBysupersedes:decompileAll'scancelled,SourceToBundleReference'scancelled,ProcessScenarioPreparation'scancelled/aborted, the reset closure inBinarySession, and Frida'srejectBeforeStartclosure.carriedReason(signal?.reason)with a comment. TypeScript cannot narrow a captured signal inside a listener.AnalysisProviderRegistryuses the departing caller's reason thatSharedStartupAttempt.waitnow returns (refactor(errors): require a reason for every analysis cancellation #10566).SIGINT/SIGTERMcontrollers andBinarySession's prompt-completionabort()calls (no reason reaches a cancellation from them today), and W4b finalization.Contract and boundary impact
cancelledByandisAbortedinsrc/domain/analysisErrorCore.ts(from refactor(errors): require a reason for every analysis cancellation #10566);SharedStartupAttempt.waitnow owns the departing caller's reason.causeis not projected.Expected effects: none checked. This changes error construction only.
Evidence and regression coverage
src/application/binary/BinarySessionInvestigation.test.ts: shutdown refusals without a caller abort now expectOwnerCancellation.ownerClosed. The test previously pinnedcausetoundefined, so it fails against the unmigrated code.ReverseEngineeringServiceclose orDesktopBuildOwnedWorkclose reasons; both are source-derived.Validation performed
npm run check:fast— passed (typecheck, lint).node scripts/verify/architecture-guards.mjs— passed; baseline 442 sites in 156 files, none undersrc/application/.npm run test:focused --the 90 test files beside the changed modules (src/application/**, matched by module name) plussrc/process/SharedStartupAttempt.test.ts— 90 files passed; 1766 tests passed, 17 skipped.npm run test:focused --the 57tests/files that import a changed application module and assert on cancellation orcause— 57 passed; 1256 tests passed, 1 skipped.npx oxfmton changed files — formatted.main(b0e3257), 2026-11-15: main (perf(mcp): run Kilo's read-only Git probes through execFileOutput's process group #10800) rewrote Kilo project-root discovery inMcpRegistrationGit.tsontoexecFileOutput, which supersedes this PR's edits to the old owned-command cleanup path there; resolved onto main's version and converted its two remaining direct cancellations tocancelledBy.npm run check:fastpassed;node scripts/verify/architecture-guards.mjs --shrink-baselines, then the guard passed (staleMcpRegistrationGit.tsbindCleanupDependenciesentry lowered to 0);npm run test:focused -- src/application/McpRegistrationGit.test.ts src/application/binary/BinarySessionInvestigation.test.ts: 32 tests passed.Compatibility, safety, and release
Author readiness
Human owner:
Before merge
type(scope): outcome.