Skip to content

refactor(mcp): bind Rizin debugger tools under external-mutation admission through the shared table - #11629

Merged
morluto merged 2 commits into
refactor/bind-frida-toolsfrom
refactor/bind-rizin-debug-tools
Nov 16, 2026
Merged

morluto merged 2 commits into
refactor/bind-frida-toolsfrom
refactor/bind-rizin-debug-tools

Conversation

@morluto

@morluto morluto commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds a binding kind for commands that run under the session's external-mutation admission with owned cleanup, and binds the four Rizin debugger tools (start_rizin_debug_session, rizin_debug_command, rizin_debug_session_status, close_rizin_debug_session) through the shared table with it. Stacked on #11625. GDB and Cutter follow in their own PRs (maintainer-approved scope: same admission, cleanup ownership and failure retention).

Problem and expected behavior

The table had no kind for tools that may change the bound artifact, so GDB, Rizin and Cutter each re-wired runWithExternalMutationAdmission / runOwnedCleanupWithExternalMutationAdmission, cleanup retry and delivery by hand. Expected: the binding states what the command is, and one handler owns admission, cleanup retry, owned close and delivery, unchanged.

Change and scope

  • src/server/externalMutationToolHandler.ts: ExternalMutation (evidence | value | owned-cleanup) and its handler. It calls the existing admission helpers with the same arguments the Rizin handlers passed: retryCleanup before evidence/value commands; the completed Evidence as partial when retirement fails or is cancelled; a value command's retained identifiers (Rizin's session_id) kept on cancellation; owned-cleanup through runOwnedCleanupWithExternalMutationAdmission keyed by the resource the input names. evidence takes detail: "delivery" for a retained summary (GDB console, next PR).
  • src/server/contractToolBindings.ts: ExternalMutationBinding ({ session, mutation }).
  • src/server/serviceToolBindings.ts: rizinDebug group; status is a plain value binding (no admission, as before). createServer.ts registers it with the session.
  • Removed src/server/registerRizinDebugTools.ts; baseline 4 sites removed. scripts/ci/scopes.mjs routes the moved code (externalMutationToolHandler.ts, serviceToolBindings.ts, the Rizin MCP tests and fixture) to the reverse_tools lane in place of the deleted file. Tests that registered it build the server with tests/fixtures/rizinDebugMcp.ts.

Behavior visible to MCP clients: a failed start or close is delivered through the shared partial-error path (identical unless the error carries partial Evidence, which these do not today); start, command and close are logged as before.

Contract and boundary impact

  • Semantic owner and earliest changed stage: MCP registration; external-mutation admission and cleanup ownership stay in externalMutationAdmission.ts and BinarySession.
  • Contribution scope fit and linked maintainer decision: coordinator-approved for GDB, Rizin and Cutter (keep admission, cleanup ownership and failure retention identical).
  • CLI and MCP/tool-catalog contract: schemas unchanged; no CLI change.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: unchanged.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): admission retires the bound analysis around each command as before; a failed cleanup stays owned and is retried before the next command; a close that is its own blocker runs once.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: 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

Lifecycle regressions added (tests/boundary/mcp/rizinExternalMutationLifecycleMcp.test.ts, real BinarySession admission, fake manager):

  • Cleanup retry: a command fails with an owned detach; the next start retries cleanup, is refused while the retry fails (start not run), and runs once the retry releases it.
  • Cancellation during final cleanup: with a bound target whose provider close (the retirement after the command) is held, the caller cancels after that close starts; the target is still retired and the completed command's Evidence is recorded through the session writer. Fails when the handler drops completed-Evidence retention.
  • Owned close as its own blocker (mixed outcomes): the first close fails and stays owned, a command is refused meanwhile, and the retried close releases its own blocker and runs exactly once more.

Existing Rizin MCP suites pass unchanged through the new server fixture (launch provenance, startup admission across a bound session, command cancellation, pending and preserved output, stopped session, inferior stdin).

Remaining proof gaps: the new regressions use a fake manager; real Rizin runs only in the provider suites listed (8 skipped where Rizin or a TTY is unavailable).

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/mcp/rizinExternalMutationLifecycleMcp.test.ts tests/boundary/mcp/rizinDebuggerCancellationMcp.test.ts tests/boundary/mcp/rizinOutputPreservation.test.ts tests/boundary/mcp/rizinPendingOutput.test.ts tests/boundary/mcp/rizinStoppedSessionMcp.test.ts tests/boundary/providers/RizinDebugSessionInferiorStdin.test.ts tests/boundary/mcp/fridaLifecycleMcp.test.ts tests/boundary/mcp/fridaMcp.test.ts tests/boundary/mcp/optionalProviderIsolation.test.ts tests/boundary/mcp/browserMcp.test.ts tests/boundary/mcp/serverUnknownsMcp.test.ts tests/boundary/mcp/evidenceImportCancellation.test.ts tests/boundary/mcp/environmentBundleMcp.test.ts — 148 passed, 8 skipped (on d4a7c17)
  • After review (7bc1b5c): npm run test:focused -- tests/boundary/filesystem/ciChangeScope.test.ts tests/boundary/filesystem/ciRequiredLanes.test.ts tests/boundary/filesystem/ciQualification.test.ts tests/boundary/filesystem/reverseToolsMutationConfig.test.ts tests/boundary/mcp/rizinExternalMutationLifecycleMcp.test.ts — 460 passed; the cleanup-cancellation test fails with completed-Evidence retention removed
  • node scripts/verify/architecture-guards.mjs --shrink-baselines — baseline lowered, passed
  • npm run check:fast — passed
  • npx oxfmt on changed files — clean

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: no real Rizin run beyond the suites above.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: admission and cleanup ownership unchanged; covered by the regressions above.

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.

@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-16T00:42:28.480442Z
We couldn’t complete this review. Comment @codex review to try again.
f2372f8 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.

@morluto
morluto changed the base branch from refactor/bind-session-records to refactor/bind-frida-tools November 16, 2026 00:42
@morluto
morluto force-pushed the refactor/bind-rizin-debug-tools branch from f2372f8 to cb16c32 Compare November 16, 2026 00:46
@greptile-apps

greptile-apps Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Low impact] No new blocking issue found; confirm whether this PR should close as superseded.

Summary

Moves the four Rizin debugger tools into the shared binding table while preserving mutation admission, cleanup ownership, and saved Evidence.

  • Rizin debugger tools now use the shared MCP binding table.

Supersession: Local origin/main already contains equivalent Rizin bindings, cleanup-cancellation coverage, and CI paths in later debugger refactors, including #11637. This PR appears superseded; live PR status was not checked.

No new actionable defect or security issue found. Tests were not rerun.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[MCP request] --> B[Shared binding table]
  B -->|Status| C[Rizin status read]
  B -->|Start, command, close| D[Shared mutation handler]
  D --> E[Session admission and cleanup ownership]
  E --> F[Rizin manager]
  F --> G[Retire bound analysis]
  G --> H[Deliver result or retained partial Evidence]
  C --> H
Loading

Reviews (3) · Last reviewed commit: "test(mcp): cancel a Rizin command during..." · Reviewed by Greptile

Comment thread src/server/createServer.ts Resolved
@morluto
morluto merged commit b5cc29a into refactor/bind-frida-tools Nov 16, 2026
2 checks passed
@morluto
morluto deleted the refactor/bind-rizin-debug-tools branch November 16, 2026 01:01
morluto added a commit that referenced this pull request Nov 16, 2026
…red table (#11621)

* refactor(mcp): bind Frida discovery and session tools through the shared table

* refactor(mcp): bind browser observation tools through the shared table (#11622)

* refactor(mcp): bind session record tools through the shared table (#11625)

* fix(mcp): record a completed provider-backed workflow's Evidence once before delivery

* refactor(mcp): bind Rizin debugger tools under external-mutation admission through the shared table (#11629)

* refactor(mcp): bind Rizin debugger tools under external-mutation admission through the shared table

* test(mcp): cancel a Rizin command during its retirement close, and route moved code to the reverse-tools lane
@morluto morluto added area: mcp MCP server, transport, and tool registration 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

area: mcp MCP server, transport, and tool registration provider: rizin Analysis provider / engine: rizin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant