Skip to content

refactor(mcp): bind objdump and Rizin commands through the shared table - #11653

Merged
morluto merged 3 commits into
refactor/bind-provider-operation-toolsfrom
refactor/bind-reverse-engineering-tools
Nov 16, 2026
Merged

morluto merged 3 commits into
refactor/bind-provider-operation-toolsfrom
refactor/bind-reverse-engineering-tools

Conversation

@morluto

@morluto morluto commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

Binds inspect_with_objdump and execute_rizin_command through the shared binding table and deletes registerReverseEngineeringTools.ts. The Rizin command runs on the external-mutation kind already used by the debuggers, with a new prepare step that validates the request and settles inspection cleanup before admission. Stacked on #11649. Refs #10583.

Problem and expected behavior

The reverse-engineering registration re-implemented external-mutation admission, the retirement-failure mapping and partial-error delivery that externalMutationToolHandler already owns for Rizin debug, GDB and Cutter, and also called invalidateSnapshotForExternalMutation inside an admission that already invalidates the snapshot itself (BinarySession.withAdmittedExternalMutation). Expected: one owner for external-mutation commands; a malformed request or a still-failing inspection cleanup is refused before admission, so the bound target stays open, as today.

Change and scope

  • src/server/externalMutationToolHandler.ts: the evidence kind takes either run or prepare(input) → Result<EvidenceCommand>; a prepare refusal is delivered without entering admission.
  • src/server/serviceToolBindings.ts: reverseEngineering group. inspect_with_objdump is a run binding (analysis admission, shared recording/partial delivery). execute_rizin_command is mutation: { kind: "evidence", prepare, retryCleanup }: prepare resolves the request with resolveRizinCommandRequest and retries the service's inspection cleanup; the command runs executeRizinCommandValidated.
  • Removed BinarySessionPort.invalidateSnapshotForExternalMutation (its only caller; the session invalidates the snapshot inside the same admission before the command runs).
  • CI/mutation configs (scripts/ci/scopes.mjs, vitest.reverse-tools.config.ts, tsconfig.reverse-tools-mutation.json, stryker.config.mjs) point at externalMutationToolHandler.ts instead of the deleted file.
  • Tests: tests/support/reverseEngineeringMcpHarness.ts registers through the table; reverseEngineeringPartialMcp.test.ts call sites use it. The two tests that asserted the adapter's own snapshot invalidation (with a fake admission, and the "legacy" no-session path production never composes) are replaced by: admission before dispatch; a still-failing inspection cleanup refuses before admission; malformed input never enters admission. The symlink test uses the real BinarySession and still checks that the target is retired and must be reopened.
  • bespoke-mcp-tool-registration: 10 → 8 sites; with refactor(mcp): bind layout, browser scenario, runtime observation, guided workflow and native matching tools through the shared table #11646–refactor(mcp): bind provider operations through the shared table #11649 and this PR, only desktop build (2) and Electron (6) remain.

Includes #11658 (collapsed here): the ten desktop build tools bind through the table (ForwardedValue outcome, presentResult whole-response redaction), so the guard lists only Electron (6 sites). Not included: Electron (D7).

Review fix: prepare is now the named prepareRizinCommand, selected as its own Stryker target and included in the reverse-tools coverage and mutation tsconfig. Removing either pre-admission check fails refuses a Rizin command before admission while inspection cleanup still fails / refuses malformed Rizin input before admission (checked by hand).

Contract and boundary impact

  • Semantic owner and earliest changed stage: MCP registration; external-mutation admission stays in BinarySession / externalMutationAdmission.ts.
  • Contribution scope fit and linked maintainer decision: W1 cleanup; no new capability or authority.
  • 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: Rizin still retires the bound analysis around the command and keeps a failed cleanup owned; the request and inspection cleanup are still checked before admission.
  • Generated metadata, package, or installation impact: none.

Visible differences: when the active analysis cannot be retired after a successful Rizin command, the message is the shared one ("The external command may have changed the bound artifact, but the active analysis session could not be retired.") instead of naming Rizin; the error code and details are unchanged. A malformed Rizin request is refused immediately rather than after waiting for an in-flight open/close transition. Without a session, the inspection cleanup retry also runs before the command (the command already retried it itself).

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: pre-admission refusal (cleanup still failing; malformed input) asserts the admission is never entered; the real-session symlink test covers retirement after success and after timeout with partial Evidence; the debugger external-mutation lifecycle suite still covers cleanup retry and cancellation during retirement for the shared handler.
  • Remaining proof gaps: no real Rizin binary in these tests (fake runOwned).

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/reverseEngineeringPartialMcp.test.ts tests/boundary/mcp/commandObservationViews.test.ts tests/boundary/mcp/reverseEngineeringProviderEnvironmentMcp.test.ts tests/boundary/mcp/reverseEngineeringEnvironmentMcp.test.ts tests/boundary/mcp/capabilityRemediationMcp.test.ts tests/boundary/mcp/workflowSnapshotReplayMcp.test.ts tests/acceptance/rizinCommandRejection.test.ts tests/acceptance/rizinCommandOutcomes.test.ts tests/boundary/mcp/debuggerExternalMutationLifecycleMcp.test.ts tests/boundary/mcp/toolSchemaValidity.test.ts — 1 failed first (a fake service lacked retryCleanup, which prepare now calls on the no-session path; fixture updated), then passed
  • npm run test:focused -- tests/composition/reverseEngineering.test.ts tests/composition/reverseEngineeringAdmission.test.ts tests/composition/reverseEngineeringEdgeCases.test.ts tests/composition/reverseEngineeringCancellation.test.ts tests/composition/analysis-sessions/binarySession.test.ts — 167 passed
  • npm run test:focused -- tests/boundary/filesystem/ciChangeScope.test.ts tests/boundary/filesystem/reverseToolsMutationConfig.test.ts — 413 passed (after repointing the reverse-tools configs)
  • npm run test:focused -- tests/boundary/filesystem/ciChangeScope.test.ts tests/boundary/filesystem/reverseToolsMutationConfig.test.ts tests/boundary/mcp/reverseEngineeringPartialMcp.test.ts — 428 passed after the review fix; with both prepareRizinCommand checks removed by hand, the two pre-admission refusal tests failed
  • desktop build (from refactor(mcp): bind the desktop build tools through the shared table #11658): npm run test:focused -- the eight tests/boundary/mcp/build*Mcp.test.ts / compactInputSchemaMcp.test.ts files — 125 passed
  • npm run check:fast — passed; npx oxfmt --check . — passed; architecture guards with --shrink-baselines — lowered to Electron only, passed

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: none.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: external-mutation admission and cleanup ownership unchanged; the pre-admission checks are kept.

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 output (if applicable) includes 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-16T01:56:47.778888Z
We couldn’t complete this review. Comment @codex review to try again.
a1c89a2 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 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The reviewed changes appear safe to merge; no new blocking issue was found.

Summary

Moves objdump, Rizin commands, and the ten desktop build tools into the shared binding table.

  • Objdump and Rizin commands use shared tool bindings.
  • Desktop build tools use shared bindings and keep redacted replies.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A["Shared binding table"] --> B["inspect_with_objdump"]
  B --> C["Analysis admission and Evidence delivery"]
  A --> D["execute_rizin_command"]
  D --> E["prepareRizinCommand"]
  E -->|Refused| F["Return error without retiring target"]
  E -->|Ready| G["External-mutation admission"]
  G --> H["Clear snapshot, run command, retire target"]
  H --> I["Deliver Evidence or partial error"]
  A --> J["Desktop build tools"]
  J --> K["Parse input and run existing workflow"]
  K --> L["Deliver value and forwarded content"]
  L --> M["Redact returned text and structured content"]
Loading

Reviews (2) · Last reviewed commit: "refactor(mcp): bind the desktop build to..." · Reviewed by Greptile

Comment thread stryker.config.mjs Resolved
@morluto
morluto force-pushed the refactor/bind-reverse-engineering-tools branch from c90ca83 to 5f0003b Compare November 16, 2026 02:18
@morluto

morluto commented Nov 16, 2026

Copy link
Copy Markdown
Owner Author

Issue 1 (moved checks lose mutation coverage) is fixed in 3365272, and #11658 (desktop build) is collapsed into this branch; details in the resolved thread. @greptileai review

@morluto
morluto merged commit 986be5a into refactor/bind-provider-operation-tools Nov 16, 2026
2 checks passed
@morluto
morluto deleted the refactor/bind-reverse-engineering-tools branch November 16, 2026 02:24
morluto added a commit that referenced this pull request Nov 16, 2026
)

* refactor(mcp): bind provider operations through the shared table

* fix(mcp): bind a provider operation only to the contract of the same name

* refactor(mcp): bind objdump and Rizin commands through the shared table (#11653)

* refactor(mcp): bind objdump and Rizin commands through the shared table

* test(rizin): keep the pre-admission Rizin checks under the mutation sweep

* refactor(mcp): bind the desktop build tools through the shared table
morluto added a commit that referenced this pull request Nov 16, 2026
…shared table (#11647)

* refactor(mcp): bind close_binary and reset_investigation through the shared table

* refactor(mcp): bind provider operations through the shared table (#11649)

* refactor(mcp): bind provider operations through the shared table

* fix(mcp): bind a provider operation only to the contract of the same name

* refactor(mcp): bind objdump and Rizin commands through the shared table (#11653)

* refactor(mcp): bind objdump and Rizin commands through the shared table

* test(rizin): keep the pre-admission Rizin checks under the mutation sweep

* refactor(mcp): bind the desktop build tools through the shared table
@morluto morluto added area: mcp MCP server, transport, and tool registration provider: objdump Analysis provider / engine: objdump 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: objdump Analysis provider / engine: objdump provider: rizin Analysis provider / engine: rizin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant