Skip to content

refactor(mcp): bind GDB and Cutter tools under external-mutation admission through the shared table - #11637

Merged
morluto merged 2 commits into
mainfrom
refactor/bind-gdb-cutter-tools
Nov 16, 2026
Merged

morluto merged 2 commits into
mainfrom
refactor/bind-gdb-cutter-tools

Conversation

@morluto

@morluto morluto commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

Binds the four GDB tools (start_gdb_session, gdb_console, gdb_session_status, close_gdb_session) and cutter_command through the shared service binding table on the external-mutation kind added for Rizin (#11629, merged with #11621), and deletes registerGdbTools.ts and registerCutterTools.ts. Base: main. Refs #10583.

Problem and expected behavior

GDB and Cutter still wired runWithExternalMutationAdmission / runOwnedCleanupWithExternalMutationAdmission, cleanup retry, retained-summary delivery and partial-error delivery by hand, so the three debugger families could drift. Expected: each binding states what the command is, and the shared handler owns admission, cleanup retry, owned close and delivery, unchanged.

Change and scope

  • src/server/serviceToolBindings.ts:
    • gdb group (GdbToolOptions { manager, session }): start_gdb_session and gdb_session_status are value bindings outside admission, as before (starting GDB loads no target); gdb_console is mutation: { kind: "evidence", detail: "delivery" } with retryCleanup = manager.retryCleanupFailures(); close_gdb_session is owned-cleanup keyed by session_id.
    • cutterSessions becomes cutter (CutterToolOptions { service, session }): list_cutter_sessions unchanged; cutter_command is mutation: { kind: "evidence" } with retryCleanup = service.retryCleanup().
  • src/server/createServer.ts: GDB, Cutter and Rizin register in one registerServiceTools call with the session; the duplicate recordSessionEvidence closure (identical to createSessionRecorders().recordEvidence) is removed and its last consumer uses recordEvidence.
  • Removed registerGdbTools.ts (4 sites) and registerCutterTools.ts (1 site); bespoke-mcp-tool-registration baseline lowered.
  • Tests: tests/fixtures/rizinDebugMcp.ts becomes tests/fixtures/debuggerMcp.ts (rizinDebugMcpServer, gdbMcpServer, cutterMcpServer over one shared builder). The 10 GDB and 4 Cutter test registration sites build their server through it. scripts/ci/scopes.mjs drops the deleted files from reverse_tools and routes the fixture, tests/boundary/mcp/gdb*.test.ts and the lifecycle file there.

Not included: session tools (registerSessionTools.ts), Electron (waits on D7), and the other bespoke registrations.

Contract and boundary impact

  • Semantic owner and earliest changed stage: MCP registration only; admission and cleanup ownership stay in externalMutationAdmission.ts, BinarySession, GdbSessionManager and CutterBridgeService.
  • Contribution scope fit and linked maintainer decision: coordinator-approved (bind GDB and Cutter on the external-mutation kind with the same lifecycle regressions).
  • 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: gdb_console and cutter_command retire the bound analysis around the 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, package, or installation impact: none.

Behavior visible to MCP clients: a failed close_gdb_session is delivered through the shared partial-error path (identical unless the error carries partial Evidence, which close errors do not today). gdb_session_status and list_cutter_sessions/start_gdb_session calls are now logged by the shared value handler like other tools (status was not logged before).

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: tests/boundary/mcp/rizinExternalMutationLifecycleMcp.test.ts becomes debuggerExternalMutationLifecycleMcp.test.ts, run for Rizin, GDB and Cutter (real BinarySession admission, fake managers): cleanup retry before the next mutation while the retry fails; cancellation during the retirement close keeps the completed command's Evidence; owned close as its own blocker runs once (Rizin and GDB; Cutter owns no closable session, so that case is skipped for it). Mutation check: replacing GDB/Cutter retryCleanup with a no-op and dropping the gdb_console session made 4 GDB/Cutter cases fail (the cancellation case times out waiting for retirement); Rizin rows stayed green.
  • Existing GDB/Cutter suites pass through the fixture: startup cleanup retry, console cancellation, inferior TTY, MI UTF-8 status, partial Evidence from command and startup errors, owned-cleanup recovery, close disposition (real GDB stub), retirement cancellation, Cutter cancellation/cleanup race/generation proof/discovery cancellation, command observation views.
  • Test reads changed: those GDB tests read error bodies from structuredContent, which only a plain McpServer returned; EvidenceMcpServer (the production server) sends errors as text only, so they now read them with parseMcpToolError. The asserted fields are unchanged.
  • Remaining proof gaps: lifecycle regressions use fake managers; real GDB runs in the GDB stub suites only.

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/debuggerExternalMutationLifecycleMcp.test.ts — 8 passed, 1 skipped
  • npm run test:focused -- tests/boundary/mcp/gdbCancellationMcp.test.ts — 7 passed
  • npm run test:focused -- tests/boundary/mcp/gdbCloseDisposition.test.ts tests/boundary/mcp/gdbCancellationMcp.test.ts — passed after the error-read change
  • npm run test:focused -- tests/boundary/mcp/cutterCancellationMcp.test.ts tests/boundary/mcp/cutterMcp.test.ts tests/boundary/mcp/gdbRetirementCancellation.test.ts tests/boundary/mcp/commandObservationViews.test.ts — 19 passed
  • npm run test:focused -- 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 — 52 passed, 8 skipped
  • npm run test:focused -- tests/boundary/filesystem/ciChangeScope.test.ts tests/boundary/filesystem/ciRequiredLanes.test.ts — 433 passed
  • npm run test:focused -- tests/boundary/mcp/targetContentFramingMcp.test.ts tests/boundary/mcp/outputSchemaProfile.test.ts tests/boundary/mcp/cutterMcp.test.ts — 21 passed
  • npm run check:fast — passed; npx oxfmt --check . — passed; node scripts/verify/architecture-guards.mjs --shrink-baselines — baseline lowered, guards passed; pre-push hook passed

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: GDB close disposition runs a real GDB stub; no real Cutter.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: admission and cleanup paths unchanged; same helpers, same arguments.

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-16T01:11:15.136461Z
We couldn’t complete this review. Comment @codex review to try again.
c78c506 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.

Base automatically changed from refactor/bind-frida-tools to main November 16, 2026 01:14
@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 PR appears safe to merge; no actionable defects were found in the changed paths.

Summary

Moves GDB and Cutter registration into the shared binding table while preserving debugger admission, cleanup retry, summaries, and error delivery.

  • GDB and Cutter tools use the shared MCP binding table.
  • Session tools now use the shared MCP binding and result handlers.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  Bindings["Shared binding table"] --> Kind{"Operation kind"}
  Kind -->|Value| Value["Run without analysis admission"]
  Kind -->|Query or analysis| Admit["Admit current analysis"]
  Admit --> Workflow["Run session operation"]
  Kind -->|External mutation| Cleanup["Retry retained cleanup"]
  Cleanup --> Command["Run debugger command"]
  Command --> Retire["Retire bound analysis"]
  Kind -->|Owned cleanup| Close["Admit and run close once"]
  Value --> Delivery["Shared result delivery"]
  Workflow --> Delivery
  Retire --> Delivery
  Close --> Delivery
Loading

Reviews (3) · Last reviewed commit: "refactor(mcp): bind the session target, ..." · Reviewed by Greptile

…ssion through the shared table

GDB start and status, and Cutter discovery, bind as values outside admission; gdb_console and cutter_command bind on the external-mutation evidence kind (gdb_console with delivery detail), and close_gdb_session on owned-cleanup. Tests build their servers through one debugger fixture, and the Rizin lifecycle regressions now run for all three debuggers.
…ools through the shared table (#11640)

Value bindings can return a ReducibleValue (alternatives tried when the complete value overflows) or a DetailedFailure (facts delivered beside the error's details). A new query binding reads the analysis its required admission grants. open_binary and open_bundle_resources bind as values; get_navigation_context and inspect_address_context as queries; capture_process_scenario on the analyze kind through an application owner that records its Evidence and residual unknowns.
@morluto
morluto merged commit e94ca9f into main Nov 16, 2026
8 checks passed
@morluto
morluto deleted the refactor/bind-gdb-cutter-tools branch November 16, 2026 01:28
Afloat16 added a commit to Afloat16/rea that referenced this pull request Nov 16, 2026
Reuse the core registrar for decompile-all instead of registering it twice
after upstream morluto#11680. Assert the outer MCP start/completion notifications
separately from provider cleanup progress introduced by morluto#11637, retaining
cleanup, rate, timeout, cancellation, and evidence assertions.
N0zoM1z0 pushed a commit that referenced this pull request Nov 22, 2026
* feat(evidence): paginate retained evidence discovery summaries

Let callers page summary metadata in canonical Evidence ID order without loading record payloads into the response. Keep filter and link totals global to all matches and preserve the unpaged response for existing clients.

* test(evidence): use the supported compact schema profile

* docs(evidence): explain the summary pagination request default

* test: align verification fixtures with current public contracts

Keep the production changes from upstream and update the verification consumers that still asserted their retired contracts:

- assert unknown workflow identity structurally and retain the bounded provider caveats;
- observe the process capture's partial-error delivery while preserving live cleanup ownership assertions;
- use the package's declared imports in the isolated release controller;
- refresh the replay card digest after the Evidence subject identity migration;
- use the supported compact Kimi profile while testing case-insensitive environment keys;
- assert each public interface's own capture issue path.

These are shared test and verifier compatibility repairs. The evidence summary pagination and config-printer feature changes remain separate.

* test: observe the session close result in Kuna retry coverage

* test: follow the persisted DOL snapshot target identity

* test: align CLI and progress fixtures with shared owners

Reuse the core registrar for decompile-all instead of registering it twice
after upstream #11680. Assert the outer MCP start/completion notifications
separately from provider cleanup progress introduced by #11637, retaining
cleanup, rate, timeout, cancellation, and evidence assertions.

* docs: link CLI paging guidance to its canonical contract
@morluto morluto added area: mcp MCP server, transport, and tool registration provider: cutter Analysis provider / engine: cutter provider: gdb Analysis provider / engine: gdb 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: cutter Analysis provider / engine: cutter provider: gdb Analysis provider / engine: gdb

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant