Repository navigation
fix(mcp)!: return a compact binary_session status by default - #7127
Merged
Merged
Conversation
binary_session {} with no target open returned about 66 KB, most of it
provider rejection diagnostics and candidate capability sets that the
skill's recovery flow re-reads on every retry. 6.8.0 grew it by 21%
because the shared regex capability limitation began repeating setting
bounds and step-by-step recovery for every search operation of every
provider (#6099, #6267, #6301, #7049) and IDA gained that limitation for
its two search operations (#4862).
The regex limitation now states the effective deadline and heap, their
sources and where to change them; the deadline and heap errors keep the
full recovery. binary_session gains detail: summary (default) or
complete. The summary keeps open state, target identity, the binding,
route capabilities, run, activity and health status, each candidate's
availability and target-support status, code and reason, and every
tool's availability, reason, remediation and modes, and lists the
fields it leaves out in omitted_fields. Complete detail returns the
previous shape. The CLI capabilities and providers commands keep
complete provider facts through the same application projection.
BREAKING CHANGE: binary_session {} no longer returns
analysis_provider_candidates[].availability.diagnostics,
target_support.diagnostics or capabilities, or tool_availability group
surface, effects and annotations. Pass {"detail": "complete"} to get
them.
Fixes #7109
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis 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. |
Contributor
[Medium impact] The PR appears safe to merge; all three previous findings are addressed and no new actionable issues were found. Summary
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A["binary_session request"] --> B{"detail"}
B -->|summary default| C["Candidate status and tool availability"]
C --> D["Response with omitted_fields"]
B -->|complete| E["Diagnostics, capabilities and static flags"]
E --> F["Complete response"]
Reviews (2) · Last reviewed commit: "fix(mcp): key binary_session output fiel..." · Reviewed by Greptile |
The output schema accepted detail: "complete" with summary candidates or tool groups, and a summary without omitted_fields, so detail did not tell callers which fields existed. Each session kind is now crossed with a detail-specific shape: a summary requires omitted_fields and summary-only candidates and tool groups; complete requires diagnostics, candidate capabilities and static tool flags and forbids omitted_fields. Both the canonical schema and the SDK-validated advertised schema reject mismatched shapes. The verifier helper accepts summary candidates only for a validated MCP summary; CLI provider output still requires candidate capabilities. Regex limitation tests check values, sources and setting names instead of whole sentences. Co-Authored-By: Claude Opus 5.5 <[email protected]>
3 tasks done
4 tasks done
This was referenced Nov 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What broke:
binary_session {}with no target open returned about 66 KB (an estimated 19K tokens). It grew 21% in 6.8.0, and the skill's recovery flow pays that on every retry.Fix: the regex capability limitation goes back to stating facts (the recovery steps stay on the errors), and
binary_sessiongainsdetail: "summary" | "complete". The default summary is 15.7 KB and keeps every decision fact. It lists what it leaves out inomitted_fields.Risk: callers that read candidate
diagnostics/capabilitiesor toolsurface/effects/annotationsfrom the default response must now pass{"detail": "complete"}. This is marked!.Summary
Fixes #7109.
Before this change, the target-free
binary_session {}returned every provider's rejection diagnostics, each candidate's capability sets, and tool availability grouped by static catalog flags. That is 66,077 bytes on a host with no deep-analysis provider configured. The skill sends agents here when a tool is unadvertised and during connection recovery. Now the default is a summary of 15,668 bytes that still answers "what can I call, and if not, why and how do I fix it".{"detail": "complete"}returns the previous shape.Problem and expected behavior
Regression source (6.7.0 → 6.8.0, +10,309 chars in
analysis_provider_candidates):regexMatchingLimitation,src/process/RegexMatcher.ts) grew from 198 to 1,646–1,694 chars. It appears once for each search operation of each provider (Hopper, IDA, Kuna ×search_procedures/search_strings), so six times. That accounts for +9,276 chars. The commits that grew it:update_analysis_settingswording.configuration_details,configuration_remediation, +384 chars). New effect flags account for the rest.The pre-existing ~55 KB baseline was itself mostly diagnostics and capability sets that an idle status check does not need.
Change and scope
regexMatchingDeadlineErrorandregexWorkerHeapError, where they are actionable. They matchdocs/native-investigation.md. This also shrinks every IDA regex search's Evidencelimitations, which pushed the same text.binary_sessionhad no detail, summary or paging contract. This addsdetailusing the repository's existingsummary/completevocabulary.capabilitiesclient_featuresandserver_identityprovider,selected, and availability and target-supportstatus/code/reasonavailable/reason/remediation/modes/client_requirements, grouped by those facts onlydiagnostics, candidatecapabilities, and tool groupsurface/effects/annotations, and lists those paths inomitted_fields. Omitted fields are not false or empty.binarySessionStatus(application) projects candidates, andcompactToolAvailability(application) projects tool groups. The MCP handler passes the caller'sdetail. CLIcapabilities/providerskeep complete provider facts through the same projection, and prompt completion asks for the summary.expandMcpSessionStatuskeeps summary candidates only for a contract-validated MCP summary. CLIexpandProviderOutputstill requires candidate capabilities.complete.SKILL.md,native-and-artifacts.md,connection-and-recovery.md) anddocs/mcp-contracts.mddescribe the summary and the opt-in.not_configuredreason prefix ("REA configuration is invalid: …"), which reads oddly for an unset variable. I also did not touch fix(mcp): advertise reduced array elements with Gemini-compatible item types #7107/fix(mcp): fit every advertised input schema within the 64 KiB client limit #7119 schema-presentation files.Contract and boundary impact
Semantic owner and earliest changed stage: the regex limitation producer (
src/process/RegexMatcher.ts). The session status projection (src/application/binary/BinarySessionStatus.ts,src/application/CapabilityInventory.ts) and the contract (src/contracts/sessionStatusContract.ts,toolOutputSchemaPrimitives.ts).Contribution scope fit and linked maintainer decision: not applicable. This is a regression and efficiency fix within the existing tool.
CLI and MCP/tool-catalog contract:
binary_sessiongets a new optional input,detail(defaultsummary). The output addsdetailand, for summaries,omitted_fields. Candidates andtool_availabilityaccept the summary or complete form. The output schema keys each result's candidate, tool-group and omission fields bydetail: every session kind is crossed with the summary and complete shapes, andomitted_fieldsis required for a summary and forbidden for complete. The advertisedbinary_sessiondefinition grows from 24,062 to 35,107 bytes, paid once per session intools/list. CLI output is unchanged.Provider, bridge, target-format, or platform compatibility: provider adapters only receive shorter regex limitation text. No provider behavior changes.
Evidence, artifact, provenance, or reconstruction contract: IDA regex search Evidence carries the shorter limitation. Unknown and unavailable status, code and reason stay visible in the summary.
Target selection, authority, upstream behavior, and cleanup details: none.
cleanup_pending,provider_operation_healthand the mid-finalizationunknownreason stay inline.Generated metadata, package, or installation impact: the generated catalog picks up the new input and description.
docs:checkandmetadata:checkpass.Documentation or usability only; no target interaction.
Evidence and regression coverage
Measured on macOS arm64 with a real stdio
@modelcontextprotocol/client2.3.1 against the built server. NoREA_*/Ghidra/IDA/JADX/Kuna variables were set, with an isolatedHOME. Results were identical with the real host environment, which has no provider configured. LLDB is present. Ghidra, IDA and Hopper are absent. Sizes are bytes ofresult.content[0].text;structuredContentcarries the same JSON again. Token counts are estimates at 3.5 bytes/token, not tokenizer counts.binary_sessioncall{}{"detail":"complete"}/System/Applications/Calculator.appopenIdle summary breakdown:
tool_availability9,274, routecapabilities3,180,analysis_provider_candidates1,395,server_identity1,128 andomitted_fields268. On main,analysis_provider_candidateswas 35,794 andtool_availabilitywas 25,587. The summary has 16 tool groups where main had 78. I did not compare call latency:binary_sessionstill runs every availability probe, and single-run timings (0.5–3.4 s) were dominated by noise. CPU time and peak memory were not measured.Representative summary output (idle, excerpt):
{"open": false, "detail": "summary", "omitted_fields": ["analysis_provider_candidates.availability.diagnostics", "analysis_provider_candidates.target_support.diagnostics", "analysis_provider_candidates.capabilities", "tool_availability.groups.surface", "tool_availability.groups.effects", "tool_availability.groups.annotations"], "analysis_provider_candidates": [ {"provider": {"id": "ghidra", "name": "Ghidra", "version": null}, "availability": {"status": "unavailable", "code": "not_configured", "reason": "Set GHIDRA_INSTALL_DIR to an extracted Ghidra 12.1.x release directory."}, "target_support": {"status": "unknown", "code": null, "reason": "No target is open."}, "selected": false}, "…"], "tool_availability": {"client_requirements": {"…": "…"}, "groups": [{"names": ["address_name", "…"], "available": false, "reason": "target_required", "remediation": "Call open_binary with a supported local target."}, "…"]}}Counterexamples tested:
TOOL_CONTRACTS. Each tool'savailable/reason/remediation/modes/client_requirementsequals the complete projection (providerSelectionMcp.test.ts,runtime.test.ts,sqliteDatabaseCli.test.ts,sessionMcp.test.ts).{status: "available", code: null, reason: null}. Its diagnostics and capabilities are returned withcomplete.status: "unknown"and the "finalization is in progress" reason.completekeepsdiagnostics.finalization(providerSelectionMcp.test.ts, cancelled and physical cases, plus a unit case).open_binary. Route capabilities and the binding match between summary and complete, and an unsupported target-support code and reason are kept (unit).code: "not_configured"and the reason are kept.detail. It is rejected without starting a provider.omitted_fields, complete withomitted_fields, and swapped candidates or tool groups in each direction are all rejected. This holds for both the canonical contract and the advertisedtools/listschema through the SDKAjvJsonSchemaValidator(providerSelectionMcp.test.ts).tests/boundary/process/mcpVerifierResults.test.ts).RegexMatcher.test.ts).Remaining proof gaps:
scripts/verify-claude-client.mjswas not run.Validation performed
npm run typecheck: pass.npm run check:fast: pass, on 5f64263 with main fc43e28.npm run format:check: pass.npm run docs:check: pass.npm run metadata:check: pass.npm run test:focused -- tests/boundary/mcp/toolSchemaValidity.test.ts tests/boundary/mcp/deferredRuntime.test.ts tests/boundary/mcp/contractPresentation.test.ts: 46/46 pass, so the advertised JSON Schemas validate.vitest run --maxWorkers=2on unit and source tests:BinarySessionStatus,CapabilityInventory,RegexMatcher,regexMatchingDeadline,regexWorkerHeapRequest,IdaProvider,BundleResourcesMcp,AnalysisProviderRegistry,analysisErrorProjectionandtoolOutputReferences: pass.providerSelectionMcp,serverIdentity,fridaLifecycleMcp,jebMcp,electronMcp,sessionMcpandruntime: pass after the test updates.vitest run --maxWorkers=2across 67 related test files (every file that mentionsbinary_session,tool_availabilityor the regex limitation, plus the unit and verifier tests), after rebuilding 5f64263: 64 pass. Three tests also fail on unmodified main bc14312 on this host (Node 26.5.0, below the engines range):dshClientSetup(setup dry-run exits 1)sqliteDatabaseCli"beyond SQLite bind capacity"hopperStartupRecovery"denial-shaped failure" (Hopper is not installed)Compatibility, safety, and release
binary_session {}used to returnanalysis_provider_candidates[].availability.diagnostics,target_support.diagnosticsandcapabilities, andtool_availability.groups[].surface/effects/annotations. These are now omitted by default and listed inomitted_fields. To migrate, pass{"detail": "complete"}, which returns the previous shape plusdetail: "complete". Keeping complete as the default would keep the ~66 KB cost on every recovery check, which is what this issue is about. A client that sendsdetailto an older server is rejected by that server's strict input schema.Author readiness
Human owner: @kaoru0822-kitauji
Before merge
type(scope): outcome.🤖 Generated with Claude Code