Skip to content

fix(rizin): refuse a start after shutdown began as an owner-closed cancellation - #11041

Merged
morluto merged 1 commit into
mainfrom
fix/rizin-closed-start-cancellation
Nov 15, 2026
Merged

morluto merged 1 commit into
mainfrom
fix/rizin-closed-start-cancellation

Conversation

@morluto

@morluto morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Summary

A Rizin debug session start made after closeAll began (REA shutting down) failed with an AnalysisInputError naming inferior_tty, while GDB returns an owner-closed cancellation. OwnedDebuggerSessionRegistry now 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() then start(...). The start's shutdown check returned a missing-argument input error on inferior_tty, which tells the caller to fix an input that was fine. Expected (and GDB's behavior): AnalysisCancelledError with OwnerCancellation.ownerClosed, or the caller's own reason when its signal had already aborted.

Change and scope

  • OwnedDebuggerSessionRegistry.start refuses when the caller already aborted (caller's reason) or closing began (owner-closed). abortStarts is renamed closeStarts and also marks the registry closed, so the refusal and the in-flight abort share one owner.
  • GDB: its local closing/aborted pre-check is removed; the Linux host check moved into the reserved start so a refused start still reports the cancellation first (same precedence as before).
  • Rizin: the inferior_tty input 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.
  • Not included: other shutdown messages (status/close while closing) are unchanged. Scope: ordinary fix within existing boundaries; maintainer scope decision not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: src/process/OwnedDebuggerSessionRegistry.ts (start admission after close). Consumers: GdbSessionManager, RizinDebugSessionManager; GDB's duplicated pre-check removed.
    • Contribution scope fit and linked maintainer decision: ordinary fix; not applicable.
  • CLI and MCP/tool-catalog contract: no schema change. The error returned by start_rizin_debug_session during shutdown changes from an input error to a cancellation (see Compatibility).
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): a refused start never spawns a debugger or reserves capacity.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; 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.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: 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.
  • Base reproduction or other evidence: with src/ reverted to the base, the new test fails and receives AnalysisInputError.
  • User-visible CLI/MCP output (if applicable): the shutdown-time start now reports a cancellation (owner closed) instead of an inferior_tty input error.
  • Remaining proof gaps: no real Rizin or GDB run (fixture managers only); Linux-only paths covered with an injected linux platform 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:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

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.
  • Same Rizin file with src/ reverted to base — the new test failed (AnalysisInputError).
  • npm run check:fast — passed. node scripts/verify/architecture-guards.mjs — passed. npx oxfmt --check on touched dirs — passed.
  • macOS only.

Compatibility, safety, and release

  • Breaking changes or migration steps: not marked breaking. User-visible error change: start_rizin_debug_session during shutdown now fails as AnalysisCancelledError (owner closed) instead of AnalysisInputError on inferior_tty, matching start_gdb_session. The input error was wrong (the input was valid), and shutdown is not a state a caller can repair.
    • Real Hopper/Ghidra, browser, or OS coverage: none.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: a refused start launches nothing.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

…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.
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-15T10:52:41.017583Z
We couldn’t complete this review. Comment @codex review to try again.
5cb305a 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@greptile-apps

greptile-apps Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The PR appears safe to merge; the shared registry refuses starts after shutdown begins while preserving the caller’s abort reason.

Summary

Moves shutdown-time start refusal into OwnedDebuggerSessionRegistry for both debuggers. Rizin now returns owner-closed cancellation instead of an inferior_tty input error.

  • Rizin and GDB starts use one gate when their managers close.

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"]
Loading

Reviews (1) · Last reviewed commit: "fix(rizin): refuse a start after shutdow..." · Reviewed by Greptile

@morluto
morluto merged commit bcb068c into main Nov 15, 2026
13 of 14 checks passed
@morluto
morluto deleted the fix/rizin-closed-start-cancellation branch November 15, 2026 11:34
@morluto morluto added bug Something isn't working provider: rizin Analysis provider / engine: rizin labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working provider: rizin Analysis provider / engine: rizin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant