Repository navigation
fix(rizin): refuse a start after shutdown began as an owner-closed cancellation - #11041
Conversation
…ncellation OwnedDebuggerSessionRegistry owns the rule: closeStarts refuses later starts as owner-closed (a caller that already aborted keeps its own reason) and aborts in-flight ones. Rizin no longer reports an inferior_tty input error for a start made after closeAll began; GDB's local copy of the rule is gone. User-visible: start_rizin_debug_session called while REA is shutting down now fails as a cancellation (owner closed) instead of an input error naming inferior_tty, matching start_gdb_session.
Codex Review Summary: ❌ FailedThis 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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
[Medium impact] The PR appears safe to merge; the shared registry refuses starts after shutdown begins while preserving the caller’s abort reason. SummaryMoves shutdown-time start refusal into
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["GDB or Rizin start"] --> B{"Caller already aborted?"}
B -->|Yes| C["Return caller's cancellation reason"]
B -->|No| D{"Start admission closed?"}
D -->|Yes| E["Return owner-closed cancellation"]
D -->|No| F["Register start, then check and reserve capacity"]
G["Manager shutdown"] --> H["Close start admission"]
H --> I["Abort and await registered starts"]
I --> J["Close owned sessions"]
Reviews (1) · Last reviewed commit: "fix(rizin): refuse a start after shutdow..." · Reviewed by Greptile |
Summary
A Rizin debug session start made after
closeAllbegan (REA shutting down) failed with anAnalysisInputErrornaminginferior_tty, while GDB returns an owner-closed cancellation.OwnedDebuggerSessionRegistrynow owns the one rule for both debuggers: once closing starts, a new start is refused as an owner-closed cancellation, and a caller that already aborted keeps its own reason.No issue filed; recorded as a proposed follow-up in the W4 debugger-registry work (#11020).
Problem and expected behavior
Trigger:
RizinDebugSessionManager.closeAll()thenstart(...). The start's shutdown check returned a missing-argument input error oninferior_tty, which tells the caller to fix an input that was fine. Expected (and GDB's behavior):AnalysisCancelledErrorwithOwnerCancellation.ownerClosed, or the caller's own reason when its signal had already aborted.Change and scope
OwnedDebuggerSessionRegistry.startrefuses when the caller already aborted (caller's reason) or closing began (owner-closed).abortStartsis renamedcloseStartsand also marks the registry closed, so the refusal and the in-flight abort share one owner.inferior_ttyinput error for a closed manager is removed. Capacity check and reservation moved into the registered start (#startWithReservation, the same shape as GDB), so a closed manager refuses before capacity is read.status/closewhile closing) are unchanged. Scope: ordinary fix within existing boundaries; maintainer scope decision not applicable.Contract and boundary impact
src/process/OwnedDebuggerSessionRegistry.ts(start admission after close). Consumers:GdbSessionManager,RizinDebugSessionManager; GDB's duplicated pre-check removed.start_rizin_debug_sessionduring shutdown changes from an input error to a cancellation (see Compatibility).docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs andskills/; edit authored instructions in.agents/skills/reverse-engineer-anything/and never commit build outputs): none.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
tests/boundary/providers/RizinDebugSessionReviewRegressions.test.ts"refuses a Rizin start made after closeAll began as owner-closed, keeping a caller's own abort reason". GDB's existing "cancels and drains GDB starts before closeAll resolves" covers the GDB side.src/reverted to the base, the new test fails and receivesAnalysisInputError.inferior_ttyinput error.linuxplatform on macOS.For boundary fixes, identify the applicable boundary regressions
and lifecycle regressions
covered by the evidence above, and explain relevant gaps.
For evidence-bearing changes:
Validation performed
npm run test:focused -- tests/boundary/providers/RizinDebugSessionReviewRegressions.test.ts tests/boundary/providers/GdbSessionReviewRegressions.test.ts tests/boundary/providers/RizinDebugSessionAdmission.test.ts tests/boundary/providers/GdbSessionManagers.test.ts tests/boundary/mcp/gdbCancellationMcp.test.ts— 61 passed, 2 skipped.src/reverted to base — the new test failed (AnalysisInputError).npm run check:fast— passed.node scripts/verify/architecture-guards.mjs— passed.npx oxfmt --checkon touched dirs — passed.Compatibility, safety, and release
start_rizin_debug_sessionduring shutdown now fails asAnalysisCancelledError(owner closed) instead ofAnalysisInputErroroninferior_tty, matchingstart_gdb_session. The input error was wrong (the input was valid), and shutdown is not a state a caller can repair.Author readiness
Human owner:
Before merge
type(scope): outcome.