Repository navigation
refactor(mcp): bind GDB and Cutter tools under external-mutation admission through the shared table - #11637
Conversation
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; no actionable defects were found in the changed paths. SummaryMoves GDB and Cutter registration into the shared binding table while preserving debugger admission, cleanup retry, summaries, and error delivery.
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
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.
c78c506 to
a2ef71c
Compare
…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.
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.
* 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
Summary
Binds the four GDB tools (
start_gdb_session,gdb_console,gdb_session_status,close_gdb_session) andcutter_commandthrough the shared service binding table on the external-mutation kind added for Rizin (#11629, merged with #11621), and deletesregisterGdbTools.tsandregisterCutterTools.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:gdbgroup (GdbToolOptions { manager, session }):start_gdb_sessionandgdb_session_statusare value bindings outside admission, as before (starting GDB loads no target);gdb_consoleismutation: { kind: "evidence", detail: "delivery" }withretryCleanup=manager.retryCleanupFailures();close_gdb_sessionisowned-cleanupkeyed bysession_id.cutterSessionsbecomescutter(CutterToolOptions { service, session }):list_cutter_sessionsunchanged;cutter_commandismutation: { kind: "evidence" }withretryCleanup=service.retryCleanup().src/server/createServer.ts: GDB, Cutter and Rizin register in oneregisterServiceToolscall with the session; the duplicaterecordSessionEvidenceclosure (identical tocreateSessionRecorders().recordEvidence) is removed and its last consumer usesrecordEvidence.registerGdbTools.ts(4 sites) andregisterCutterTools.ts(1 site);bespoke-mcp-tool-registrationbaseline lowered.tests/fixtures/rizinDebugMcp.tsbecomestests/fixtures/debuggerMcp.ts(rizinDebugMcpServer,gdbMcpServer,cutterMcpServerover one shared builder). The 10 GDB and 4 Cutter test registration sites build their server through it.scripts/ci/scopes.mjsdrops the deleted files fromreverse_toolsand routes the fixture,tests/boundary/mcp/gdb*.test.tsand the lifecycle file there.Not included: session tools (
registerSessionTools.ts), Electron (waits on D7), and the other bespoke registrations.Contract and boundary impact
externalMutationAdmission.ts,BinarySession,GdbSessionManagerandCutterBridgeService.gdb_consoleandcutter_commandretire 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.Behavior visible to MCP clients: a failed
close_gdb_sessionis delivered through the shared partial-error path (identical unless the error carries partial Evidence, which close errors do not today).gdb_session_statusandlist_cutter_sessions/start_gdb_sessioncalls 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.
Evidence and regression coverage
tests/boundary/mcp/rizinExternalMutationLifecycleMcp.test.tsbecomesdebuggerExternalMutationLifecycleMcp.test.ts, run for Rizin, GDB and Cutter (realBinarySessionadmission, 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/CutterretryCleanupwith a no-op and dropping thegdb_consolesession made 4 GDB/Cutter cases fail (the cancellation case times out waiting for retirement); Rizin rows stayed green.structuredContent, which only a plainMcpServerreturned;EvidenceMcpServer(the production server) sends errors as text only, so they now read them withparseMcpToolError. The asserted fields are unchanged.For evidence-bearing changes:
Validation performed
npm run test:focused -- tests/boundary/mcp/debuggerExternalMutationLifecycleMcp.test.ts— 8 passed, 1 skippednpm run test:focused -- tests/boundary/mcp/gdbCancellationMcp.test.ts— 7 passednpm run test:focused -- tests/boundary/mcp/gdbCloseDisposition.test.ts tests/boundary/mcp/gdbCancellationMcp.test.ts— passed after the error-read changenpm 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 passednpm 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 skippednpm run test:focused -- tests/boundary/filesystem/ciChangeScope.test.ts tests/boundary/filesystem/ciRequiredLanes.test.ts— 433 passednpm run test:focused -- tests/boundary/mcp/targetContentFramingMcp.test.ts tests/boundary/mcp/outputSchemaProfile.test.ts tests/boundary/mcp/cutterMcp.test.ts— 21 passednpm run check:fast— passed;npx oxfmt --check .— passed;node scripts/verify/architecture-guards.mjs --shrink-baselines— baseline lowered, guards passed; pre-push hook passedCompatibility, safety, and release
Author readiness
Human owner:
Before merge
type(scope): outcome.