Skip to content

refactor(mcp): bind close_binary and reset_investigation through the shared table - #11647

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

morluto merged 2 commits into
mainfrom
refactor/bind-session-lifecycle-tools

Conversation

@morluto

@morluto morluto commented Nov 16, 2026

Copy link
Copy Markdown
Owner

Summary

Binds close_binary and reset_investigation through the shared service binding table as value bindings outside analysis admission, and deletes registerCloseLifecycleTool.ts and registerResetInvestigationTool.ts. Stacked on #11646. Refs #10583.

Problem and expected behavior

The two session lifecycle tools registered by hand, each re-implementing logging and result delivery next to the cleanup composition they own. Expected: the bindings state the lifecycle calls; the shared value handler logs and delivers; the cleanup composition stays in one module.

Change and scope

  • src/server/registerCloseLifecycleTool.ts → src/server/sessionLifecycle.ts: closeWithProcessResources (session close + process-capture cleanup, unchanged composition and retry binding) and resetCleanupRetry (process + artifact cleanup a reset joins, moved from the reset file unchanged). CLOSE_RETRY exported.
  • src/server/serviceToolBindings.ts: sessionLifecycle group. close_binary keeps the ordering rule (the close is enqueued before progress transport is awaited, so a later open cannot overtake it), the progress start/end reports and the snapshot receipt. reset_investigation calls session.resetInvestigation with the same arguments.
  • src/server/registerSessionTools.ts: lifecycle and status register in one registerServiceTools call; LifecycleToolRegistration is now SessionStatusToolOptions & SessionLifecycleOptions (the unused closeContract is gone).
  • bespoke-mcp-tool-registration baseline: 13 → 11 sites.
  • tests/boundary/mcp/processCleanupRetryMcp.test.ts captured the composed error by spying on toCallToolResult; the value handler delivers errors through toPartialErrorToolResult (identical wire output without a session writer), so the spy moves there. Assertions unchanged.

Not included: registerEvidenceTools, reverse engineering, desktop build (next slices); Electron (D7).

Contract and boundary impact

  • Semantic owner and earliest changed stage: MCP registration only; BinarySession still owns lifecycle ordering, checkpoint publication and cleanup retry.
  • Contribution scope fit and linked maintainer decision: W1 cleanup; no new capability.
  • CLI and MCP/tool-catalog contract: 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: same close/reset composition, same retry binding (close_binary), same ordering.
  • Generated metadata, package, or installation impact: none.

Visible difference: the shared value handler's log line now covers the whole close call (including progress reports) rather than only the close itself; reset calls are now logged.

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: processCleanupRetryMcp.test.ts (spy seam only).
  • Lifecycle regressions exercised by existing suites: process-capture cleanup retry through close_binary (returned/thrown/synchronous session-close failure composed with the pending root, then retry), reset artifact cleanup, snapshot close and replay, selected snapshot cleanup, session availability recovery.
  • Remaining proof gaps: none known beyond the existing suites.

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/sessionMcp.test.ts tests/boundary/mcp/processCleanupRetryMcp.test.ts tests/boundary/mcp/resetArtifactCleanupMcp.test.ts tests/boundary/mcp/investigationLifecycleMcp.test.ts tests/boundary/mcp/selectedSnapshotCleanupMcp.test.ts tests/boundary/mcp/sessionAvailabilityRecovery.test.ts tests/boundary/mcp/successEvidenceLifecycleMcp.test.ts tests/boundary/mcp/errorEvidenceLifecycleMcp.test.ts tests/boundary/mcp/toolSchemaValidity.test.ts — 3 failed in processCleanupRetryMcp (the toCallToolResult spy saw no error); after moving the spy, processCleanupRetryMcp.test.ts 4 passed; the other 8 files passed
  • npm run test:focused -- tests/boundary/mcp/workflowSnapshotReplayMcp.test.ts tests/boundary/mcp/investigationAnalysisMcp.test.ts tests/boundary/mcp/providerSelectionMcp.test.ts tests/acceptance/nativeDispatchSnapshot.test.ts tests/boundary/mcp/absoluteLocalPathSchema.test.ts — 61 passed
  • npm run check:fast — passed; npx oxfmt on changed files; architecture guards with --shrink-baselines — lowered, passed; pre-push hook 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: cleanup ownership unchanged.

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:43:54.101458Z
We couldn’t complete this review. Comment @codex review to try again.
268fb29 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-optional-provider-and-session-tools to main November 16, 2026 01:46
@greptile-apps

greptile-apps Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

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

Summary

Moves lifecycle tools, provider operations, reverse-engineering tools, and desktop build tools through the shared binding table.

  • Provider-backed MCP tools run their named operation through shared bindings.
  • Close and reset tools now use the shared session binding path.
  • Rizin and objdump tools now use shared bindings with session-owned admission.
  • Desktop-build tools now use shared value bindings and result delivery.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Server composition] --> B[Shared service bindings]
  B --> C[Named contract registration]
  C --> D[Provider handler]
  C --> E[External mutation handler]
  C --> F[Value handler]
  D --> G[Analysis admission]
  E --> H[Session orders mutation and cleanup]
  F --> I[Lifecycle or desktop operation]
  G --> J[Evidence delivery]
  H --> J
  I --> K[Value delivery]
  K --> L[Desktop result redaction when configured]
Loading

Reviews (7) · Last reviewed commit: "refactor(mcp): bind provider operations ..." · Reviewed by Greptile

@morluto

morluto commented Nov 16, 2026

Copy link
Copy Markdown
Owner Author

Rebased onto main (770ae95) after #11646 merged, to clear the merge conflict the gate reported; content unchanged. @greptileai review

)

* 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 merged commit b7fe131 into main Nov 16, 2026
13 of 14 checks passed
@morluto
morluto deleted the refactor/bind-session-lifecycle-tools branch November 16, 2026 02:39
@morluto morluto added the area: mcp MCP server, transport, and tool registration label 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant